mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
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:
@@ -14,6 +14,10 @@ fn F(T:! type, U:! type) {
|
||||
|
||||
// CHECK:STDOUT: --- fail_type_param_mismatch.carbon
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %.1: type = ptr_type T [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]
|
||||
@@ -22,7 +26,7 @@ fn F(T:! type, U:! type) {
|
||||
// CHECK:STDOUT: fn @F(%T: type, %U: type) {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %T.ref: type = name_ref T, %T [symbolic = %T]
|
||||
// CHECK:STDOUT: %.loc8: type = ptr_type T [template]
|
||||
// CHECK:STDOUT: %.loc8: type = ptr_type T [template = constants.%.1]
|
||||
// CHECK:STDOUT: %p.var: ref T* = var p
|
||||
// CHECK:STDOUT: %p: ref T* = bind_name p, %p.var
|
||||
// CHECK:STDOUT: %U.ref: type = name_ref U, %U [symbolic = %U]
|
||||
|
||||
@@ -11,6 +11,10 @@ fn F(T:! type) {
|
||||
|
||||
// CHECK:STDOUT: --- type_param.carbon
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: constants {
|
||||
// CHECK:STDOUT: %.1: type = ptr_type T [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]
|
||||
@@ -19,7 +23,7 @@ fn F(T:! type) {
|
||||
// CHECK:STDOUT: fn @F(%T: type) {
|
||||
// CHECK:STDOUT: !entry:
|
||||
// CHECK:STDOUT: %T.ref.loc8: type = name_ref T, %T [symbolic = %T]
|
||||
// CHECK:STDOUT: %.loc8: type = ptr_type T [template]
|
||||
// CHECK:STDOUT: %.loc8: type = ptr_type T [template = constants.%.1]
|
||||
// CHECK:STDOUT: %p.var: ref T* = var p
|
||||
// CHECK:STDOUT: %p: ref T* = bind_name p, %p.var
|
||||
// CHECK:STDOUT: %T.ref.loc9: type = name_ref T, %T [symbolic = %T]
|
||||
|
||||
Reference in New Issue
Block a user