Add a separate store for computed constant values. (#3362)

This moves the instructions generated for type values out of the block
in which they happen to first be referenced, and into shared storage.
This commit is contained in:
Richard Smith
2023-11-04 23:48:13 +00:00
committed by GitHub
parent a0bacbb26b
commit 184eafd521
130 changed files with 1075 additions and 625 deletions
@@ -19,6 +19,11 @@ fn Deref(n: i32) {
*{};
}
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %.loc15: type = tuple_type ()
// CHECK:STDOUT: %.loc19: type = struct_type {}
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file "fail_dereference_not_pointer.carbon" {
// CHECK:STDOUT: %Deref: <function> = fn_decl @Deref
// CHECK:STDOUT: }
@@ -27,13 +32,11 @@ fn Deref(n: i32) {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %n.ref: i32 = name_reference "n", %n
// CHECK:STDOUT: %.loc11: ref <error> = dereference %n.ref
// CHECK:STDOUT: %.loc15_5.1: type = tuple_type ()
// CHECK:STDOUT: %.loc15_5.2: () = tuple_literal ()
// CHECK:STDOUT: %.loc15_5.3: () = tuple_value %.loc15_5.2, ()
// CHECK:STDOUT: %.loc15_3: ref <error> = dereference %.loc15_5.3
// CHECK:STDOUT: %.loc19_5.1: type = struct_type {}
// CHECK:STDOUT: %.loc19_5.2: {} = struct_literal ()
// CHECK:STDOUT: %.loc19_5.3: {} = struct_value %.loc19_5.2, ()
// CHECK:STDOUT: %.loc19_3: ref <error> = dereference %.loc19_5.3
// CHECK:STDOUT: %.loc15_5.1: () = tuple_literal ()
// CHECK:STDOUT: %.loc15_5.2: () = tuple_value %.loc15_5.1, ()
// CHECK:STDOUT: %.loc15_3: ref <error> = dereference %.loc15_5.2
// CHECK:STDOUT: %.loc19_5.1: {} = struct_literal ()
// CHECK:STDOUT: %.loc19_5.2: {} = struct_value %.loc19_5.1, ()
// CHECK:STDOUT: %.loc19_3: ref <error> = dereference %.loc19_5.2
// CHECK:STDOUT: return
// CHECK:STDOUT: }