Simplify GetConstantValue (#8005)

- Resolve Specifics eagerly during evaluation. Previous import changes
have made deferral unnecessary. This simplifies the code and unblocks
the next item.
- Overload `GetConstantValue` for all ID kinds, rather than having a
separate `GetConstantValueOrPassThrough` function, so that callers don't
have to choose between them.

---------

Co-authored-by: Dana Jansens <danakj@orodu.net>
This commit is contained in:
Geoff RomerandDana Jansens authored and GitHub committed 2026-10-20 23:21:00 +00:00
1 parent db87a84b69
commit 4441c53404
15 files changed
+1829 -1988

No files matched your search

+10 -10
View File
@@ -40,7 +40,7 @@ fn Test() -> i32 {
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: ; Function Attrs: nounwind
// CHECK:STDOUT: define i32 @"_Cfn:enclosed.57eff363c02bd6d7"(i32 %x) #0 !dbg !31 {
// CHECK:STDOUT: define i32 @"_Cfn:enclosed.c7952b8f54fe2475"(i32 %x) #0 !dbg !31 {
// CHECK:STDOUT: entry:
// CHECK:STDOUT: ret i32 %x, !dbg !34
// CHECK:STDOUT: }
@@ -61,7 +61,7 @@ fn Test() -> i32 {
// CHECK:STDOUT: !24 = !DILocalVariable(arg: 1, scope: !23, type: !20)
// CHECK:STDOUT: !29 = !DILocation(line: 3, column: 39, scope: !23)
// CHECK:STDOUT: !30 = !{!24}
// CHECK:STDOUT: !31 = distinct !DISubprogram(linkageName: "_Cfn:enclosed.57eff363c02bd6d7", scope: null, file: !18, line: 4, type: !22, spFlags: DISPFlagDefinition, unit: !19, retainedNodes: !35)
// CHECK:STDOUT: !31 = distinct !DISubprogram(linkageName: "_Cfn:enclosed.c7952b8f54fe2475", scope: null, file: !18, line: 4, type: !22, spFlags: DISPFlagDefinition, unit: !19, retainedNodes: !35)
// CHECK:STDOUT: !32 = !DILocalVariable(arg: 1, scope: !31, type: !20)
// CHECK:STDOUT: !34 = !DILocation(line: 4, column: 38, scope: !31)
// CHECK:STDOUT: !35 = !{!32}
@@ -74,10 +74,10 @@ fn Test() -> i32 {
// CHECK:STDOUT: define i32 @_CTest.Main() #0 !dbg !40 {
// CHECK:STDOUT: entry:
// CHECK:STDOUT: %fn.call.loc10_57 = call i32 @"_Cfn:enclosed.3c14c8ca6559e7d0"(i32 1), !dbg !43
// CHECK:STDOUT: %fn.call.loc10_58 = call i32 @"_Cfn:enclosed.57eff363c02bd6d7"(i32 %fn.call.loc10_57), !dbg !44
// CHECK:STDOUT: %fn.call.loc10_58 = call i32 @"_Cfn:enclosed.c7952b8f54fe2475"(i32 %fn.call.loc10_57), !dbg !44
// CHECK:STDOUT: %fn.call.loc10_59 = call i32 @"_Cfn:enclosed.78e97d08196088b9"(i32 %fn.call.loc10_58), !dbg !45
// CHECK:STDOUT: %fn.call.loc10_60 = call i32 @"_Cfn:enclosed.0e7773781338b8b4"(i32 %fn.call.loc10_59), !dbg !46
// CHECK:STDOUT: %fn.call.loc10_61 = call i32 @"_Cfn:enclosed.84edee9c65852fed"(i32 %fn.call.loc10_60), !dbg !47
// CHECK:STDOUT: %fn.call.loc10_60 = call i32 @"_Cfn:enclosed.0e7270695e932392"(i32 %fn.call.loc10_59), !dbg !46
// CHECK:STDOUT: %fn.call.loc10_61 = call i32 @"_Cfn:enclosed.1fd415d9d5ad7882"(i32 %fn.call.loc10_60), !dbg !47
// CHECK:STDOUT: ret i32 %fn.call.loc10_61, !dbg !48
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -88,18 +88,18 @@ fn Test() -> i32 {
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: ; Function Attrs: nounwind
// CHECK:STDOUT: define i32 @"_Cfn:enclosed.0e7773781338b8b4"(i32 %x) #0 !dbg !57 {
// CHECK:STDOUT: define i32 @"_Cfn:enclosed.0e7270695e932392"(i32 %x) #0 !dbg !57 {
// CHECK:STDOUT: entry:
// CHECK:STDOUT: ret i32 %x, !dbg !60
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: ; Function Attrs: nounwind
// CHECK:STDOUT: define i32 @"_Cfn:enclosed.84edee9c65852fed"(i32 %y) #0 !dbg !62 {
// CHECK:STDOUT: define i32 @"_Cfn:enclosed.1fd415d9d5ad7882"(i32 %y) #0 !dbg !62 {
// CHECK:STDOUT: entry:
// CHECK:STDOUT: ret i32 %y, !dbg !65
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: declare i32 @"_Cfn:enclosed.57eff363c02bd6d7"(i32)
// CHECK:STDOUT: declare i32 @"_Cfn:enclosed.c7952b8f54fe2475"(i32)
// CHECK:STDOUT:
// CHECK:STDOUT: declare i32 @"_Cfn:enclosed.3c14c8ca6559e7d0"(i32)
// CHECK:STDOUT:
@@ -128,11 +128,11 @@ fn Test() -> i32 {
// CHECK:STDOUT: !50 = !DILocalVariable(arg: 1, scope: !49, type: !20)
// CHECK:STDOUT: !55 = !DILocation(line: 7, column: 5, scope: !49)
// CHECK:STDOUT: !56 = !{!50}
// CHECK:STDOUT: !57 = distinct !DISubprogram(linkageName: "_Cfn:enclosed.0e7773781338b8b4", scope: null, file: !36, line: 9, type: !22, spFlags: DISPFlagDefinition, unit: !37, retainedNodes: !61)
// CHECK:STDOUT: !57 = distinct !DISubprogram(linkageName: "_Cfn:enclosed.0e7270695e932392", scope: null, file: !36, line: 9, type: !22, spFlags: DISPFlagDefinition, unit: !37, retainedNodes: !61)
// CHECK:STDOUT: !58 = !DILocalVariable(arg: 1, scope: !57, type: !20)
// CHECK:STDOUT: !60 = !DILocation(line: 9, column: 28, scope: !57)
// CHECK:STDOUT: !61 = !{!58}
// CHECK:STDOUT: !62 = distinct !DISubprogram(linkageName: "_Cfn:enclosed.84edee9c65852fed", scope: null, file: !36, line: 10, type: !22, spFlags: DISPFlagDefinition, unit: !37, retainedNodes: !66)
// CHECK:STDOUT: !62 = distinct !DISubprogram(linkageName: "_Cfn:enclosed.1fd415d9d5ad7882", scope: null, file: !36, line: 10, type: !22, spFlags: DISPFlagDefinition, unit: !37, retainedNodes: !66)
// CHECK:STDOUT: !63 = !DILocalVariable(arg: 1, scope: !62, type: !20)
// CHECK:STDOUT: !65 = !DILocation(line: 10, column: 26, scope: !62)
// CHECK:STDOUT: !66 = !{!63}