Always form a ConstType instruction for const. (#6341)

Do this even if the operand is a `ConstType` instruction. This better
preserves the source form of the type, and avoids a special case.
Repeated `const`s are already flattened in constant evaluation, and this
special case also didn't prevent forming a `ConstType` whose operand is
`const` in general, only cases where the operand happens to literally be
a `ConstType` instruction.

This reverts commit eed21f6439.
This commit is contained in:
Richard Smith
2025-11-09 18:17:09 +00:00
committed by GitHub
parent dfd9946dc2
commit 1ece5000aa
5 changed files with 11 additions and 9 deletions
@@ -940,9 +940,10 @@ fn Foo(a: const (const C)) {}
// CHECK:STDOUT: %a.param_patt: %pattern_type = value_param_pattern %a.patt, call_param0 [concrete]
// CHECK:STDOUT: } {
// CHECK:STDOUT: %a.param: %const = value_param call_param0
// CHECK:STDOUT: %.loc18: type = splice_block %const [concrete = constants.%const] {
// CHECK:STDOUT: %.loc18: type = splice_block %const.loc18_11 [concrete = constants.%const] {
// CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C]
// CHECK:STDOUT: %const: type = const_type %C.ref [concrete = constants.%const]
// CHECK:STDOUT: %const.loc18_18: type = const_type %C.ref [concrete = constants.%const]
// CHECK:STDOUT: %const.loc18_11: type = const_type %const.loc18_18 [concrete = constants.%const]
// CHECK:STDOUT: }
// CHECK:STDOUT: %a: %const = value_binding a, %a.param
// CHECK:STDOUT: }