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
+6 -3
View File
@@ -23,6 +23,9 @@ fn G() -> i32 {
// CHECK:STDOUT: %.6: i32 = int_literal 3 [template]
// CHECK:STDOUT: %.7: type = tuple_type (i32, i32, i32) [template]
// CHECK:STDOUT: %.8: i32 = int_literal 1 [template]
// CHECK:STDOUT: %.9: i32 = int_literal 0 [template]
// CHECK:STDOUT: %.10: i32 = int_literal 1 [template]
// CHECK:STDOUT: %.11: i32 = int_literal 2 [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
@@ -50,13 +53,13 @@ fn G() -> i32 {
// CHECK:STDOUT: %.loc12_20.1: (i32, i32, i32) = tuple_literal (%.loc12_13, %.loc12_16, %.loc12_19)
// CHECK:STDOUT: %.loc12_23: i32 = int_literal 1 [template = constants.%.8]
// CHECK:STDOUT: %.loc12_20.2: ref [i32; 3] = temporary_storage
// CHECK:STDOUT: %.loc12_20.3: i32 = int_literal 0
// CHECK:STDOUT: %.loc12_20.3: i32 = int_literal 0 [template = constants.%.9]
// CHECK:STDOUT: %.loc12_20.4: ref i32 = array_index %.loc12_20.2, %.loc12_20.3
// CHECK:STDOUT: %.loc12_20.5: init i32 = initialize_from %.loc12_13 to %.loc12_20.4
// CHECK:STDOUT: %.loc12_20.6: i32 = int_literal 1
// CHECK:STDOUT: %.loc12_20.6: i32 = int_literal 1 [template = constants.%.10]
// CHECK:STDOUT: %.loc12_20.7: ref i32 = array_index %.loc12_20.2, %.loc12_20.6
// CHECK:STDOUT: %.loc12_20.8: init i32 = initialize_from %.loc12_16 to %.loc12_20.7
// CHECK:STDOUT: %.loc12_20.9: i32 = int_literal 2
// CHECK:STDOUT: %.loc12_20.9: i32 = int_literal 2 [template = constants.%.11]
// CHECK:STDOUT: %.loc12_20.10: ref i32 = array_index %.loc12_20.2, %.loc12_20.9
// CHECK:STDOUT: %.loc12_20.11: init i32 = initialize_from %.loc12_19 to %.loc12_20.10
// CHECK:STDOUT: %.loc12_20.12: init [i32; 3] = array_init (%.loc12_20.5, %.loc12_20.8, %.loc12_20.11) to %.loc12_20.2