Deduplicate and canonicalize all constants. (#3611)

Rather than producing multiple constants with the same value, fold all
instances of a given constant to the same constant instruction.

A future PR will use this to replace the current type canonicalization
system.
This commit is contained in:
Richard Smith
2024-01-18 21:42:19 +00:00
committed by GitHub
parent 62db3e9ad0
commit 29c294880d
142 changed files with 1603 additions and 1185 deletions
+8
View File
@@ -11,6 +11,14 @@ fn F(p: const (const (const i32*)*)) -> const i32 {
// CHECK:STDOUT: --- nested_const.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %.1: type = const_type i32 [template]
// CHECK:STDOUT: %.2: type = ptr_type const i32 [template]
// CHECK:STDOUT: %.3: type = const_type const i32* [template]
// CHECK:STDOUT: %.4: type = ptr_type const (const i32*) [template]
// CHECK:STDOUT: %.5: type = const_type const (const i32*)* [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
// CHECK:STDOUT: package: <namespace> = namespace package, {.F = %F} [template]
// CHECK:STDOUT: %F: <function> = fn_decl @F [template]