mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 12:51:04 +01:00
Directly convert from an initializer to a value where possible. (#3306)
If the initializing representation is the same as the value representation, don't materialize a temporary and perform a value binding. Instead, directly extract the value, using a new `value_of_initializer` node. This removes a lot of redundant `alloca`s from our generated LLVM IR.
This commit is contained in:
+1
-4
@@ -30,8 +30,5 @@ fn G() -> i32 {
|
||||
// CHECK:STDOUT: %array.index2 = getelementptr inbounds [3 x i32], ptr %temp, i32 0, i32 2
|
||||
// CHECK:STDOUT: store i32 3, ptr %array.index2, align 4
|
||||
// CHECK:STDOUT: %F = call i32 @F(ptr %temp, i32 1)
|
||||
// CHECK:STDOUT: %temp3 = alloca i32, align 4
|
||||
// CHECK:STDOUT: store i32 %F, ptr %temp3, align 4
|
||||
// CHECK:STDOUT: %1 = load i32, ptr %temp3, align 4
|
||||
// CHECK:STDOUT: ret i32 %1
|
||||
// CHECK:STDOUT: ret i32 %F
|
||||
// CHECK:STDOUT: }
|
||||
|
||||
Reference in New Issue
Block a user