Ensure we evaluate instructions created in uncommon ways. (#3598)

Instructions created by splices during conversion are now evaluated, as
are instructions created in cases where we first create a placeholder
instruction and later replace it by a different instruction.

This also removes the ability to set a parse node and instruction
independently after creating an `InstId`, which could lead to them
accidentally not matching.
This commit is contained in:
Richard Smith
2024-01-16 21:28:14 +00:00
committed by GitHub
parent d712bf12a6
commit 906346cf35
42 changed files with 366 additions and 240 deletions
+2 -1
View File
@@ -17,6 +17,7 @@ fn F(b: bool, n: i32, m: i32) -> i32 {
// CHECK:STDOUT: %.3: type = ptr_type [i32; 1] [template]
// CHECK:STDOUT: %.4: i32 = int_literal 0 [template]
// CHECK:STDOUT: %.5: type = tuple_type (i32) [template]
// CHECK:STDOUT: %.6: i32 = int_literal 0 [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
@@ -32,7 +33,7 @@ fn F(b: bool, n: i32, m: i32) -> i32 {
// CHECK:STDOUT: %x: ref [i32; 1] = bind_name x, %x.var
// CHECK:STDOUT: %.loc8_22: i32 = int_literal 0 [template = constants.%.4]
// CHECK:STDOUT: %.loc8_24.1: (i32,) = tuple_literal (%.loc8_22)
// CHECK:STDOUT: %.loc8_24.2: i32 = int_literal 0
// CHECK:STDOUT: %.loc8_24.2: i32 = int_literal 0 [template = constants.%.6]
// CHECK:STDOUT: %.loc8_24.3: ref i32 = array_index %x.var, %.loc8_24.2
// CHECK:STDOUT: %.loc8_24.4: init i32 = initialize_from %.loc8_22 to %.loc8_24.3
// CHECK:STDOUT: %.loc8_24.5: init [i32; 1] = array_init (%.loc8_24.4) to %x.var