mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Treat the empty inst block as being canonical. (#4199)
TryEvalInst was assuming this to be the case when forming canonical constants, but it previously wasn't. This fixes an issue where we can end up with two identical-looking constants for an empty struct value: one with an `Empty` block and another with the canonical empty block.
This commit is contained in:
+8
-10
@@ -34,13 +34,11 @@ class Declaration(T:! type);
|
||||
// CHECK:STDOUT: %.2: type = ptr_type %Class.2 [symbolic]
|
||||
// CHECK:STDOUT: %.3: type = ptr_type %T [symbolic]
|
||||
// CHECK:STDOUT: %GetAddr.type: type = fn_type @GetAddr, @Class(%T) [symbolic]
|
||||
// CHECK:STDOUT: %GetAddr.1: %GetAddr.type = struct_value () [symbolic]
|
||||
// CHECK:STDOUT: %GetAddr: %GetAddr.type = struct_value () [symbolic]
|
||||
// CHECK:STDOUT: %GetValue.type: type = fn_type @GetValue, @Class(%T) [symbolic]
|
||||
// CHECK:STDOUT: %GetValue.1: %GetValue.type = struct_value () [symbolic]
|
||||
// CHECK:STDOUT: %GetValue: %GetValue.type = struct_value () [symbolic]
|
||||
// CHECK:STDOUT: %.4: type = unbound_element_type %Class.2, %T [symbolic]
|
||||
// CHECK:STDOUT: %.5: type = struct_type {.k: %T} [symbolic]
|
||||
// CHECK:STDOUT: %GetAddr.2: %GetAddr.type = struct_value () [symbolic]
|
||||
// CHECK:STDOUT: %GetValue.2: %GetValue.type = struct_value () [symbolic]
|
||||
// CHECK:STDOUT: %.6: type = ptr_type %.5 [symbolic]
|
||||
// CHECK:STDOUT: %Declaration.type: type = generic_class_type @Declaration [template]
|
||||
// CHECK:STDOUT: %Declaration.1: %Declaration.type = struct_value () [template]
|
||||
@@ -81,14 +79,14 @@ class Declaration(T:! type);
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: !definition:
|
||||
// CHECK:STDOUT: %GetAddr.type: type = fn_type @GetAddr, @Class(%T) [symbolic = %GetAddr.type (constants.%GetAddr.type)]
|
||||
// CHECK:STDOUT: %GetAddr: @Class.%GetAddr.type (%GetAddr.type) = struct_value () [symbolic = %GetAddr (constants.%GetAddr.1)]
|
||||
// CHECK:STDOUT: %GetAddr: @Class.%GetAddr.type (%GetAddr.type) = struct_value () [symbolic = %GetAddr (constants.%GetAddr)]
|
||||
// CHECK:STDOUT: %GetValue.type: type = fn_type @GetValue, @Class(%T) [symbolic = %GetValue.type (constants.%GetValue.type)]
|
||||
// CHECK:STDOUT: %GetValue: @Class.%GetValue.type (%GetValue.type) = struct_value () [symbolic = %GetValue (constants.%GetValue.1)]
|
||||
// CHECK:STDOUT: %GetValue: @Class.%GetValue.type (%GetValue.type) = struct_value () [symbolic = %GetValue (constants.%GetValue)]
|
||||
// CHECK:STDOUT: %Class: type = class_type @Class, @Class(%T) [symbolic = %Class (constants.%Class.2)]
|
||||
// CHECK:STDOUT: %.1: type = unbound_element_type @Class.%Class (%Class.2), @Class.%T (%T) [symbolic = %.1 (constants.%.4)]
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: class {
|
||||
// CHECK:STDOUT: %GetAddr.decl: @Class.%GetAddr.type (%GetAddr.type) = fn_decl @GetAddr [symbolic = %GetAddr (constants.%GetAddr.1)] {
|
||||
// CHECK:STDOUT: %GetAddr.decl: @Class.%GetAddr.type (%GetAddr.type) = fn_decl @GetAddr [symbolic = %GetAddr (constants.%GetAddr)] {
|
||||
// CHECK:STDOUT: %.loc12_25: type = specific_constant constants.%Class.2, @Class(constants.%T) [symbolic = @GetAddr.%Class (constants.%Class.2)]
|
||||
// CHECK:STDOUT: %Self.ref.loc12: type = name_ref Self, %.loc12_25 [symbolic = @GetAddr.%Class (constants.%Class.2)]
|
||||
// CHECK:STDOUT: %.loc12_29: type = ptr_type %Class.2 [symbolic = @GetAddr.%.1 (constants.%.2)]
|
||||
@@ -99,7 +97,7 @@ class Declaration(T:! type);
|
||||
// CHECK:STDOUT: %.loc12_38: type = ptr_type %T [symbolic = @GetAddr.%.2 (constants.%.3)]
|
||||
// CHECK:STDOUT: %return.var.loc12: ref @GetAddr.%.2 (%.3) = var <return slot>
|
||||
// CHECK:STDOUT: }
|
||||
// CHECK:STDOUT: %GetValue.decl: @Class.%GetValue.type (%GetValue.type) = fn_decl @GetValue [symbolic = %GetValue (constants.%GetValue.1)] {
|
||||
// CHECK:STDOUT: %GetValue.decl: @Class.%GetValue.type (%GetValue.type) = fn_decl @GetValue [symbolic = %GetValue (constants.%GetValue)] {
|
||||
// CHECK:STDOUT: %.loc17: type = specific_constant constants.%Class.2, @Class(constants.%T) [symbolic = @GetValue.%Class (constants.%Class.2)]
|
||||
// CHECK:STDOUT: %Self.ref.loc17: type = name_ref Self, %.loc17 [symbolic = @GetValue.%Class (constants.%Class.2)]
|
||||
// CHECK:STDOUT: %self.loc17_15.1: @GetValue.%Class (%Class.2) = param self
|
||||
@@ -166,9 +164,9 @@ class Declaration(T:! type);
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: !definition:
|
||||
// CHECK:STDOUT: %GetAddr.type => constants.%GetAddr.type
|
||||
// CHECK:STDOUT: %GetAddr => constants.%GetAddr.2
|
||||
// CHECK:STDOUT: %GetAddr => constants.%GetAddr
|
||||
// CHECK:STDOUT: %GetValue.type => constants.%GetValue.type
|
||||
// CHECK:STDOUT: %GetValue => constants.%GetValue.2
|
||||
// CHECK:STDOUT: %GetValue => constants.%GetValue
|
||||
// CHECK:STDOUT: %Class => constants.%Class.2
|
||||
// CHECK:STDOUT: %.1 => constants.%.4
|
||||
// CHECK:STDOUT: }
|
||||
|
||||
Reference in New Issue
Block a user