Start plumbing through debug info type information with function parameters/return value (#6410)

This adds just enough debug info for i32/int parameters and return
values, with a path forward for adding DWARF type metadata for other
types.

As it happens, return type information is carried separately from
parameter information:
* Return type information is carried in the `type` of the `DISubprogram`
  (as a `DISubroutineType` - which does carry parameter type information
  as well, but that's unused when the DWARF is emitted by LLVM)
* Parameter information is carried by `DILocalVariable`s with a non-zero
  `arg` value (representing the order of function parameters)

In the absence of locations for the parameters (future work), nothing
would usually keep the `DILocalVariable` live/reachable when emitting
DWARF - so for cases where this can happen (for clang, this happens in
optimized builds where all references to the parameter variable might be
optimized away) the variables can be "retained" in a list on the
`DISubprogram` - achieved by passing `AlwaysPreserve` parameter to
`createParameterVariable` (adds them to a list, then that list gets
attached to the `DISubprogram` when it's finalized later)

For now, any unsupported types are emitted as `void*` (except void
return, which is implemented as void) as a placeholder.

Given this example:
```
import Core library "io";
class MyClass {
}
fn Unsupported(v: MyClass) {
}
fn Ret() -> i32 {
  return 42;
}
fn Arg(x: i32) {
  Core.Print(x);
}
fn Run() {
}
```
this is the resulting DWARF:
```
DW_TAG_compile_unit
  DW_AT_name    ("test.carbon")
  DW_TAG_subprogram
    DW_AT_name  ("Unsupported")
    DW_TAG_formal_parameter
      DW_AT_type        (0x00000066 "void *")
  DW_TAG_subprogram
    DW_AT_name  ("Ret")
    DW_AT_type  (0x00000062 "int")
  DW_TAG_subprogram
    DW_AT_name  ("Arg")
    DW_TAG_formal_parameter
      DW_AT_type        (0x00000062 "int")
  DW_TAG_subprogram
    DW_AT_name  ("Run")
  DW_TAG_base_type
    DW_AT_name  ("int")
  DW_TAG_pointer_type
```
And the debugger:
```
(gdb) p Ret()
$1 = 42
(gdb) p Arg(4)
4
$2 = void
```

I'm not sure if there's a way this logic should be merged with the logic
for making the `llvm::Function` type (which the `DISubroutineType`
building code was inspired by/copied from) - since they're done at
different times/places, I don't think there's an easy way to do it in
one pass, but maybe the code can be shared (even if it's run twice) in
some generic `SemIR::Function` type walker.

---------

Co-authored-by: Dana Jansens <danakj@orodu.net>
This commit is contained in:
David Blaikie
2025-11-25 23:25:09 +00:00
committed by GitHub
co-authored by Dana Jansens
parent 0baa74d96f
commit a179bd461b
184 changed files with 8098 additions and 6049 deletions
+1 -1
View File
@@ -48,7 +48,7 @@ fn G() {
// CHECK:STDOUT: !3 = !DIFile(filename: "array_in_place.carbon", directory: "")
// CHECK:STDOUT: !4 = distinct !DISubprogram(name: "G", linkageName: "_CG.Main", scope: null, file: !3, line: 15, type: !5, spFlags: DISPFlagDefinition, unit: !2)
// CHECK:STDOUT: !5 = !DISubroutineType(types: !6)
// CHECK:STDOUT: !6 = !{}
// CHECK:STDOUT: !6 = !{null}
// CHECK:STDOUT: !7 = !DILocation(line: 16, column: 3, scope: !4)
// CHECK:STDOUT: !8 = !DILocation(line: 16, column: 38, scope: !4)
// CHECK:STDOUT: !9 = !DILocation(line: 16, column: 39, scope: !4)
+29 -26
View File
@@ -24,29 +24,29 @@ fn Run() {
// CHECK:STDOUT: ; Function Attrs: nounwind
// CHECK:STDOUT: define void @_CF.Main(ptr sret({ i32, i32 }) %return) #0 !dbg !4 {
// CHECK:STDOUT: entry:
// CHECK:STDOUT: %tuple.elem0.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %return, i32 0, i32 0, !dbg !7
// CHECK:STDOUT: %tuple.elem1.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %return, i32 0, i32 1, !dbg !7
// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %return, ptr align 4 @tuple.014.loc13_39, i64 8, i1 false), !dbg !8
// CHECK:STDOUT: ret void, !dbg !8
// CHECK:STDOUT: %tuple.elem0.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %return, i32 0, i32 0, !dbg !8
// CHECK:STDOUT: %tuple.elem1.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %return, i32 0, i32 1, !dbg !8
// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %return, ptr align 4 @tuple.014.loc13_39, i64 8, i1 false), !dbg !9
// CHECK:STDOUT: ret void, !dbg !9
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: ; Function Attrs: nounwind
// CHECK:STDOUT: define void @main() #0 !dbg !9 {
// CHECK:STDOUT: define void @main() #0 !dbg !10 {
// CHECK:STDOUT: entry:
// CHECK:STDOUT: %t.var = alloca [2 x i32], align 4, !dbg !10
// CHECK:STDOUT: %.loc16_28.1.temp = alloca { i32, i32 }, align 8, !dbg !11
// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %t.var), !dbg !10
// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc16_28.1.temp), !dbg !11
// CHECK:STDOUT: call void @_CF.Main(ptr %.loc16_28.1.temp), !dbg !11
// CHECK:STDOUT: %tuple.elem0.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %.loc16_28.1.temp, i32 0, i32 0, !dbg !11
// CHECK:STDOUT: %.loc16_28.3 = load i32, ptr %tuple.elem0.tuple.elem, align 4, !dbg !11
// CHECK:STDOUT: %.loc16_28.4.array.index = getelementptr inbounds [2 x i32], ptr %t.var, i32 0, i64 0, !dbg !11
// CHECK:STDOUT: store i32 %.loc16_28.3, ptr %.loc16_28.4.array.index, align 4, !dbg !11
// CHECK:STDOUT: %tuple.elem1.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %.loc16_28.1.temp, i32 0, i32 1, !dbg !11
// CHECK:STDOUT: %.loc16_28.6 = load i32, ptr %tuple.elem1.tuple.elem, align 4, !dbg !11
// CHECK:STDOUT: %.loc16_28.7.array.index = getelementptr inbounds [2 x i32], ptr %t.var, i32 0, i64 1, !dbg !11
// CHECK:STDOUT: store i32 %.loc16_28.6, ptr %.loc16_28.7.array.index, align 4, !dbg !11
// CHECK:STDOUT: ret void, !dbg !12
// CHECK:STDOUT: %t.var = alloca [2 x i32], align 4, !dbg !13
// CHECK:STDOUT: %.loc16_28.1.temp = alloca { i32, i32 }, align 8, !dbg !14
// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %t.var), !dbg !13
// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc16_28.1.temp), !dbg !14
// CHECK:STDOUT: call void @_CF.Main(ptr %.loc16_28.1.temp), !dbg !14
// CHECK:STDOUT: %tuple.elem0.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %.loc16_28.1.temp, i32 0, i32 0, !dbg !14
// CHECK:STDOUT: %.loc16_28.3 = load i32, ptr %tuple.elem0.tuple.elem, align 4, !dbg !14
// CHECK:STDOUT: %.loc16_28.4.array.index = getelementptr inbounds [2 x i32], ptr %t.var, i32 0, i64 0, !dbg !14
// CHECK:STDOUT: store i32 %.loc16_28.3, ptr %.loc16_28.4.array.index, align 4, !dbg !14
// CHECK:STDOUT: %tuple.elem1.tuple.elem = getelementptr inbounds nuw { i32, i32 }, ptr %.loc16_28.1.temp, i32 0, i32 1, !dbg !14
// CHECK:STDOUT: %.loc16_28.6 = load i32, ptr %tuple.elem1.tuple.elem, align 4, !dbg !14
// CHECK:STDOUT: %.loc16_28.7.array.index = getelementptr inbounds [2 x i32], ptr %t.var, i32 0, i64 1, !dbg !14
// CHECK:STDOUT: store i32 %.loc16_28.6, ptr %.loc16_28.7.array.index, align 4, !dbg !14
// CHECK:STDOUT: ret void, !dbg !15
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
@@ -71,10 +71,13 @@ fn Run() {
// CHECK:STDOUT: !3 = !DIFile(filename: "assign_return_value.carbon", directory: "")
// CHECK:STDOUT: !4 = distinct !DISubprogram(name: "F", linkageName: "_CF.Main", scope: null, file: !3, line: 13, type: !5, spFlags: DISPFlagDefinition, unit: !2)
// CHECK:STDOUT: !5 = !DISubroutineType(types: !6)
// CHECK:STDOUT: !6 = !{}
// CHECK:STDOUT: !7 = !DILocation(line: 13, column: 31, scope: !4)
// CHECK:STDOUT: !8 = !DILocation(line: 13, column: 24, scope: !4)
// CHECK:STDOUT: !9 = distinct !DISubprogram(name: "Run", linkageName: "main", scope: null, file: !3, line: 15, type: !5, spFlags: DISPFlagDefinition, unit: !2)
// CHECK:STDOUT: !10 = !DILocation(line: 16, column: 3, scope: !9)
// CHECK:STDOUT: !11 = !DILocation(line: 16, column: 26, scope: !9)
// CHECK:STDOUT: !12 = !DILocation(line: 15, column: 1, scope: !9)
// CHECK:STDOUT: !6 = !{!7}
// CHECK:STDOUT: !7 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 8)
// CHECK:STDOUT: !8 = !DILocation(line: 13, column: 31, scope: !4)
// CHECK:STDOUT: !9 = !DILocation(line: 13, column: 24, scope: !4)
// CHECK:STDOUT: !10 = distinct !DISubprogram(name: "Run", linkageName: "main", scope: null, file: !3, line: 15, type: !11, spFlags: DISPFlagDefinition, unit: !2)
// CHECK:STDOUT: !11 = !DISubroutineType(types: !12)
// CHECK:STDOUT: !12 = !{null}
// CHECK:STDOUT: !13 = !DILocation(line: 16, column: 3, scope: !10)
// CHECK:STDOUT: !14 = !DILocation(line: 16, column: 26, scope: !10)
// CHECK:STDOUT: !15 = !DILocation(line: 15, column: 1, scope: !10)
+1 -1
View File
@@ -92,7 +92,7 @@ fn Run() {
// CHECK:STDOUT: !3 = !DIFile(filename: "base.carbon", directory: "")
// CHECK:STDOUT: !4 = distinct !DISubprogram(name: "Run", linkageName: "main", scope: null, file: !3, line: 13, type: !5, spFlags: DISPFlagDefinition, unit: !2)
// CHECK:STDOUT: !5 = !DISubroutineType(types: !6)
// CHECK:STDOUT: !6 = !{}
// CHECK:STDOUT: !6 = !{null}
// CHECK:STDOUT: !7 = !DILocation(line: 14, column: 3, scope: !4)
// CHECK:STDOUT: !8 = !DILocation(line: 15, column: 3, scope: !4)
// CHECK:STDOUT: !9 = !DILocation(line: 16, column: 3, scope: !4)
+37 -29
View File
@@ -33,32 +33,32 @@ class A {
// CHECK:STDOUT: ; Function Attrs: nounwind
// CHECK:STDOUT: define void @_CInit.A.Main(ptr sret({ [2 x i32] }) %return) #0 !dbg !4 {
// CHECK:STDOUT: entry:
// CHECK:STDOUT: %.loc16_39.2.v = getelementptr inbounds nuw { [2 x i32] }, ptr %return, i32 0, i32 0, !dbg !7
// CHECK:STDOUT: %.loc16_38.3.array.index = getelementptr inbounds [2 x i32], ptr %.loc16_39.2.v, i32 0, i64 0, !dbg !8
// CHECK:STDOUT: %.loc16_38.6.array.index = getelementptr inbounds [2 x i32], ptr %.loc16_39.2.v, i32 0, i64 1, !dbg !8
// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %return, ptr align 4 @A.val.loc16_40, i64 8, i1 false), !dbg !9
// CHECK:STDOUT: ret void, !dbg !9
// CHECK:STDOUT: %.loc16_39.2.v = getelementptr inbounds nuw { [2 x i32] }, ptr %return, i32 0, i32 0, !dbg !8
// CHECK:STDOUT: %.loc16_38.3.array.index = getelementptr inbounds [2 x i32], ptr %.loc16_39.2.v, i32 0, i64 0, !dbg !9
// CHECK:STDOUT: %.loc16_38.6.array.index = getelementptr inbounds [2 x i32], ptr %.loc16_39.2.v, i32 0, i64 1, !dbg !9
// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %return, ptr align 4 @A.val.loc16_40, i64 8, i1 false), !dbg !10
// CHECK:STDOUT: ret void, !dbg !10
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: ; Function Attrs: nounwind
// CHECK:STDOUT: define i32 @_CAccess.A.Main(ptr %self) #0 !dbg !10 {
// CHECK:STDOUT: define i32 @_CAccess.A.Main(ptr %self) #0 !dbg !11 {
// CHECK:STDOUT: entry:
// CHECK:STDOUT: %.loc19_16.1.v = getelementptr inbounds nuw { [2 x i32] }, ptr %self, i32 0, i32 0, !dbg !11
// CHECK:STDOUT: %.loc19_20.2.array.index = getelementptr inbounds [2 x i32], ptr %.loc19_16.1.v, i32 0, i32 0, !dbg !11
// CHECK:STDOUT: %.loc19_20.3 = load i32, ptr %.loc19_20.2.array.index, align 4, !dbg !11
// CHECK:STDOUT: ret i32 %.loc19_20.3, !dbg !12
// CHECK:STDOUT: %.loc19_16.1.v = getelementptr inbounds nuw { [2 x i32] }, ptr %self, i32 0, i32 0, !dbg !17
// CHECK:STDOUT: %.loc19_20.2.array.index = getelementptr inbounds [2 x i32], ptr %.loc19_16.1.v, i32 0, i32 0, !dbg !17
// CHECK:STDOUT: %.loc19_20.3 = load i32, ptr %.loc19_20.2.array.index, align 4, !dbg !17
// CHECK:STDOUT: ret i32 %.loc19_20.3, !dbg !18
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: ; Function Attrs: nounwind
// CHECK:STDOUT: define i32 @_CUse.A.Main(ptr %self) #0 !dbg !13 {
// CHECK:STDOUT: define i32 @_CUse.A.Main(ptr %self) #0 !dbg !19 {
// CHECK:STDOUT: entry:
// CHECK:STDOUT: %.loc23_9.v = getelementptr inbounds nuw { [2 x i32] }, ptr %self, i32 0, i32 0, !dbg !14
// CHECK:STDOUT: %.loc23_13.array.index = getelementptr inbounds [2 x i32], ptr %.loc23_9.v, i32 0, i32 0, !dbg !14
// CHECK:STDOUT: store i32 1, ptr %.loc23_13.array.index, align 4, !dbg !14
// CHECK:STDOUT: %.loc24_16.v = getelementptr inbounds nuw { [2 x i32] }, ptr %self, i32 0, i32 0, !dbg !15
// CHECK:STDOUT: %.loc24_20.1.array.index = getelementptr inbounds [2 x i32], ptr %.loc24_16.v, i32 0, i32 1, !dbg !15
// CHECK:STDOUT: %.loc24_20.2 = load i32, ptr %.loc24_20.1.array.index, align 4, !dbg !15
// CHECK:STDOUT: ret i32 %.loc24_20.2, !dbg !16
// CHECK:STDOUT: %.loc23_9.v = getelementptr inbounds nuw { [2 x i32] }, ptr %self, i32 0, i32 0, !dbg !22
// CHECK:STDOUT: %.loc23_13.array.index = getelementptr inbounds [2 x i32], ptr %.loc23_9.v, i32 0, i32 0, !dbg !22
// CHECK:STDOUT: store i32 1, ptr %.loc23_13.array.index, align 4, !dbg !22
// CHECK:STDOUT: %.loc24_16.v = getelementptr inbounds nuw { [2 x i32] }, ptr %self, i32 0, i32 0, !dbg !23
// CHECK:STDOUT: %.loc24_20.1.array.index = getelementptr inbounds [2 x i32], ptr %.loc24_16.v, i32 0, i32 1, !dbg !23
// CHECK:STDOUT: %.loc24_20.2 = load i32, ptr %.loc24_20.1.array.index, align 4, !dbg !23
// CHECK:STDOUT: ret i32 %.loc24_20.2, !dbg !24
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
@@ -76,14 +76,22 @@ class A {
// CHECK:STDOUT: !3 = !DIFile(filename: "field.carbon", directory: "")
// CHECK:STDOUT: !4 = distinct !DISubprogram(name: "Init", linkageName: "_CInit.A.Main", scope: null, file: !3, line: 16, type: !5, spFlags: DISPFlagDefinition, unit: !2)
// CHECK:STDOUT: !5 = !DISubroutineType(types: !6)
// CHECK:STDOUT: !6 = !{}
// CHECK:STDOUT: !7 = !DILocation(line: 16, column: 27, scope: !4)
// CHECK:STDOUT: !8 = !DILocation(line: 16, column: 33, scope: !4)
// CHECK:STDOUT: !9 = !DILocation(line: 16, column: 20, scope: !4)
// CHECK:STDOUT: !10 = distinct !DISubprogram(name: "Access", linkageName: "_CAccess.A.Main", scope: null, file: !3, line: 18, type: !5, spFlags: DISPFlagDefinition, unit: !2)
// CHECK:STDOUT: !11 = !DILocation(line: 19, column: 12, scope: !10)
// CHECK:STDOUT: !12 = !DILocation(line: 19, column: 5, scope: !10)
// CHECK:STDOUT: !13 = distinct !DISubprogram(name: "Use", linkageName: "_CUse.A.Main", scope: null, file: !3, line: 22, type: !5, spFlags: DISPFlagDefinition, unit: !2)
// CHECK:STDOUT: !14 = !DILocation(line: 23, column: 5, scope: !13)
// CHECK:STDOUT: !15 = !DILocation(line: 24, column: 12, scope: !13)
// CHECK:STDOUT: !16 = !DILocation(line: 24, column: 5, scope: !13)
// CHECK:STDOUT: !6 = !{!7}
// CHECK:STDOUT: !7 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 8)
// CHECK:STDOUT: !8 = !DILocation(line: 16, column: 27, scope: !4)
// CHECK:STDOUT: !9 = !DILocation(line: 16, column: 33, scope: !4)
// CHECK:STDOUT: !10 = !DILocation(line: 16, column: 20, scope: !4)
// CHECK:STDOUT: !11 = distinct !DISubprogram(name: "Access", linkageName: "_CAccess.A.Main", scope: null, file: !3, line: 18, type: !12, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !15)
// CHECK:STDOUT: !12 = !DISubroutineType(types: !13)
// CHECK:STDOUT: !13 = !{!14, !7}
// CHECK:STDOUT: !14 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
// CHECK:STDOUT: !15 = !{!16}
// CHECK:STDOUT: !16 = !DILocalVariable(arg: 1, scope: !11, type: !7)
// CHECK:STDOUT: !17 = !DILocation(line: 19, column: 12, scope: !11)
// CHECK:STDOUT: !18 = !DILocation(line: 19, column: 5, scope: !11)
// CHECK:STDOUT: !19 = distinct !DISubprogram(name: "Use", linkageName: "_CUse.A.Main", scope: null, file: !3, line: 22, type: !12, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !20)
// CHECK:STDOUT: !20 = !{!21}
// CHECK:STDOUT: !21 = !DILocalVariable(arg: 1, scope: !19, type: !7)
// CHECK:STDOUT: !22 = !DILocation(line: 23, column: 5, scope: !19)
// CHECK:STDOUT: !23 = !DILocation(line: 24, column: 12, scope: !19)
// CHECK:STDOUT: !24 = !DILocation(line: 24, column: 5, scope: !19)
+27 -20
View File
@@ -26,22 +26,22 @@ fn G() -> i32 {
// CHECK:STDOUT: ; Function Attrs: nounwind
// CHECK:STDOUT: define i32 @_CF.Main(ptr %arr, i32 %i) #0 !dbg !4 {
// CHECK:STDOUT: entry:
// CHECK:STDOUT: %.loc14_15.2.array.index = getelementptr inbounds [3 x i32], ptr %arr, i32 0, i32 %i, !dbg !7
// CHECK:STDOUT: %.loc14_15.3 = load i32, ptr %.loc14_15.2.array.index, align 4, !dbg !7
// CHECK:STDOUT: ret i32 %.loc14_15.3, !dbg !8
// CHECK:STDOUT: %.loc14_15.2.array.index = getelementptr inbounds [3 x i32], ptr %arr, i32 0, i32 %i, !dbg !12
// CHECK:STDOUT: %.loc14_15.3 = load i32, ptr %.loc14_15.2.array.index, align 4, !dbg !12
// CHECK:STDOUT: ret i32 %.loc14_15.3, !dbg !13
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: ; Function Attrs: nounwind
// CHECK:STDOUT: define i32 @_CG.Main() #0 !dbg !9 {
// CHECK:STDOUT: define i32 @_CG.Main() #0 !dbg !14 {
// CHECK:STDOUT: entry:
// CHECK:STDOUT: %.loc18_20.3.temp = alloca [3 x i32], align 4, !dbg !10
// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc18_20.3.temp), !dbg !10
// CHECK:STDOUT: %.loc18_20.4.array.index = getelementptr inbounds [3 x i32], ptr %.loc18_20.3.temp, i32 0, i64 0, !dbg !10
// CHECK:STDOUT: %.loc18_20.7.array.index = getelementptr inbounds [3 x i32], ptr %.loc18_20.3.temp, i32 0, i64 1, !dbg !10
// CHECK:STDOUT: %.loc18_20.10.array.index = getelementptr inbounds [3 x i32], ptr %.loc18_20.3.temp, i32 0, i64 2, !dbg !10
// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %.loc18_20.3.temp, ptr align 4 @array.loc18_20.13, i64 12, i1 false), !dbg !10
// CHECK:STDOUT: %F.call = call i32 @_CF.Main(ptr %.loc18_20.3.temp, i32 1), !dbg !11
// CHECK:STDOUT: ret i32 %F.call, !dbg !12
// CHECK:STDOUT: %.loc18_20.3.temp = alloca [3 x i32], align 4, !dbg !17
// CHECK:STDOUT: call void @llvm.lifetime.start.p0(ptr %.loc18_20.3.temp), !dbg !17
// CHECK:STDOUT: %.loc18_20.4.array.index = getelementptr inbounds [3 x i32], ptr %.loc18_20.3.temp, i32 0, i64 0, !dbg !17
// CHECK:STDOUT: %.loc18_20.7.array.index = getelementptr inbounds [3 x i32], ptr %.loc18_20.3.temp, i32 0, i64 1, !dbg !17
// CHECK:STDOUT: %.loc18_20.10.array.index = getelementptr inbounds [3 x i32], ptr %.loc18_20.3.temp, i32 0, i64 2, !dbg !17
// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %.loc18_20.3.temp, ptr align 4 @array.loc18_20.13, i64 12, i1 false), !dbg !17
// CHECK:STDOUT: %F.call = call i32 @_CF.Main(ptr %.loc18_20.3.temp, i32 1), !dbg !18
// CHECK:STDOUT: ret i32 %F.call, !dbg !19
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: ; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
@@ -61,12 +61,19 @@ fn G() -> i32 {
// CHECK:STDOUT: !1 = !{i32 2, !"Debug Info Version", i32 3}
// CHECK:STDOUT: !2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "carbon", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug)
// CHECK:STDOUT: !3 = !DIFile(filename: "function_param.carbon", directory: "")
// CHECK:STDOUT: !4 = distinct !DISubprogram(name: "F", linkageName: "_CF.Main", scope: null, file: !3, line: 13, type: !5, spFlags: DISPFlagDefinition, unit: !2)
// CHECK:STDOUT: !4 = distinct !DISubprogram(name: "F", linkageName: "_CF.Main", scope: null, file: !3, line: 13, type: !5, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !9)
// CHECK:STDOUT: !5 = !DISubroutineType(types: !6)
// CHECK:STDOUT: !6 = !{}
// CHECK:STDOUT: !7 = !DILocation(line: 14, column: 10, scope: !4)
// CHECK:STDOUT: !8 = !DILocation(line: 14, column: 3, scope: !4)
// CHECK:STDOUT: !9 = distinct !DISubprogram(name: "G", linkageName: "_CG.Main", scope: null, file: !3, line: 17, type: !5, spFlags: DISPFlagDefinition, unit: !2)
// CHECK:STDOUT: !10 = !DILocation(line: 18, column: 12, scope: !9)
// CHECK:STDOUT: !11 = !DILocation(line: 18, column: 10, scope: !9)
// CHECK:STDOUT: !12 = !DILocation(line: 18, column: 3, scope: !9)
// CHECK:STDOUT: !6 = !{!7, !8, !7}
// CHECK:STDOUT: !7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
// CHECK:STDOUT: !8 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 8)
// CHECK:STDOUT: !9 = !{!10, !11}
// CHECK:STDOUT: !10 = !DILocalVariable(arg: 1, scope: !4, type: !8)
// CHECK:STDOUT: !11 = !DILocalVariable(arg: 2, scope: !4, type: !7)
// CHECK:STDOUT: !12 = !DILocation(line: 14, column: 10, scope: !4)
// CHECK:STDOUT: !13 = !DILocation(line: 14, column: 3, scope: !4)
// CHECK:STDOUT: !14 = distinct !DISubprogram(name: "G", linkageName: "_CG.Main", scope: null, file: !3, line: 17, type: !15, spFlags: DISPFlagDefinition, unit: !2)
// CHECK:STDOUT: !15 = !DISubroutineType(types: !16)
// CHECK:STDOUT: !16 = !{!7}
// CHECK:STDOUT: !17 = !DILocation(line: 18, column: 12, scope: !14)
// CHECK:STDOUT: !18 = !DILocation(line: 18, column: 10, scope: !14)
// CHECK:STDOUT: !19 = !DILocation(line: 18, column: 3, scope: !14)
+155 -113
View File
@@ -68,102 +68,102 @@ fn F() {
// CHECK:STDOUT:
// CHECK:STDOUT: ; Function Attrs: nounwind
// CHECK:STDOUT: define linkonce_odr i32 @"_CNewCursor.f06e388f4a5bd5ec:Iterate.Core.a21f6adcc8abe06c"(ptr %self) #0 !dbg !12 {
// CHECK:STDOUT: ret i32 0, !dbg !14
// CHECK:STDOUT: ret i32 0, !dbg !20
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: ; Function Attrs: nounwind
// CHECK:STDOUT: define linkonce_odr void @"_CNext.f06e388f4a5bd5ec:Iterate.Core.a21f6adcc8abe06c"(ptr sret({ i32, i1 }) %return, ptr %self, ptr %cursor) #0 !dbg !15 {
// CHECK:STDOUT: %1 = load i32, ptr %cursor, align 4, !dbg !16
// CHECK:STDOUT: %2 = icmp slt i32 %1, 6, !dbg !16
// CHECK:STDOUT: br i1 %2, label %3, label %7, !dbg !17
// CHECK:STDOUT: define linkonce_odr void @"_CNext.f06e388f4a5bd5ec:Iterate.Core.a21f6adcc8abe06c"(ptr sret({ i32, i1 }) %return, ptr %self, ptr %cursor) #0 !dbg !21 {
// CHECK:STDOUT: %1 = load i32, ptr %cursor, align 4, !dbg !27
// CHECK:STDOUT: %2 = icmp slt i32 %1, 6, !dbg !27
// CHECK:STDOUT: br i1 %2, label %3, label %7, !dbg !28
// CHECK:STDOUT:
// CHECK:STDOUT: 3: ; preds = %0
// CHECK:STDOUT: call void @"_COp.Int.Core:Inc.Core.be1e879c1ad406d8"(ptr %cursor), !dbg !18
// CHECK:STDOUT: %4 = load i32, ptr %cursor, align 4, !dbg !19
// CHECK:STDOUT: %5 = sub i32 %4, 1, !dbg !19
// CHECK:STDOUT: %array.index = getelementptr inbounds [6 x i32], ptr %self, i32 0, i32 %5, !dbg !20
// CHECK:STDOUT: %6 = load i32, ptr %array.index, align 4, !dbg !20
// CHECK:STDOUT: call void @_CSome.Optional.Core.9a253b43086de47c(ptr %return, i32 %6), !dbg !21
// CHECK:STDOUT: ret void, !dbg !22
// CHECK:STDOUT: call void @"_COp.Int.Core:Inc.Core.be1e879c1ad406d8"(ptr %cursor), !dbg !29
// CHECK:STDOUT: %4 = load i32, ptr %cursor, align 4, !dbg !30
// CHECK:STDOUT: %5 = sub i32 %4, 1, !dbg !30
// CHECK:STDOUT: %array.index = getelementptr inbounds [6 x i32], ptr %self, i32 0, i32 %5, !dbg !31
// CHECK:STDOUT: %6 = load i32, ptr %array.index, align 4, !dbg !31
// CHECK:STDOUT: call void @_CSome.Optional.Core.9a253b43086de47c(ptr %return, i32 %6), !dbg !32
// CHECK:STDOUT: ret void, !dbg !33
// CHECK:STDOUT:
// CHECK:STDOUT: 7: ; preds = %0
// CHECK:STDOUT: call void @_CNone.Optional.Core.9a253b43086de47c(ptr %return), !dbg !23
// CHECK:STDOUT: ret void, !dbg !24
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: ; Function Attrs: nounwind
// CHECK:STDOUT: define linkonce_odr i1 @_CHasValue.Optional.Core.9a253b43086de47c(ptr %self) #0 !dbg !25 {
// CHECK:STDOUT: %1 = call i1 @"_CHas.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899"(ptr %self), !dbg !27
// CHECK:STDOUT: ret i1 %1, !dbg !28
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: ; Function Attrs: nounwind
// CHECK:STDOUT: define linkonce_odr i32 @_CGet.Optional.Core.9a253b43086de47c(ptr %self) #0 !dbg !29 {
// CHECK:STDOUT: %1 = call i32 @"_CGet.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899"(ptr %self), !dbg !30
// CHECK:STDOUT: ret i32 %1, !dbg !31
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: ; Function Attrs: nounwind
// CHECK:STDOUT: define linkonce_odr void @"_COp.Int.Core:Inc.Core.be1e879c1ad406d8"(ptr %self) #0 !dbg !32 {
// CHECK:STDOUT: call void @"_COp:thunk.Int.Core:AddAssignWith.Core.dbc952efa35fc763"(ptr %self, i32 1), !dbg !34
// CHECK:STDOUT: call void @_CNone.Optional.Core.9a253b43086de47c(ptr %return), !dbg !34
// CHECK:STDOUT: ret void, !dbg !35
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: ; Function Attrs: nounwind
// CHECK:STDOUT: define linkonce_odr void @_CSome.Optional.Core.9a253b43086de47c(ptr sret({ i32, i1 }) %return, i32 %value) #0 !dbg !36 {
// CHECK:STDOUT: call void @"_CSome.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899"(ptr %return, i32 %value), !dbg !37
// CHECK:STDOUT: ret void, !dbg !38
// CHECK:STDOUT: define linkonce_odr i1 @_CHasValue.Optional.Core.9a253b43086de47c(ptr %self) #0 !dbg !36 {
// CHECK:STDOUT: %1 = call i1 @"_CHas.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899"(ptr %self), !dbg !42
// CHECK:STDOUT: ret i1 %1, !dbg !43
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: ; Function Attrs: nounwind
// CHECK:STDOUT: define linkonce_odr void @_CNone.Optional.Core.9a253b43086de47c(ptr sret({ i32, i1 }) %return) #0 !dbg !39 {
// CHECK:STDOUT: call void @"_CNone.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899"(ptr %return), !dbg !40
// CHECK:STDOUT: ret void, !dbg !41
// CHECK:STDOUT: define linkonce_odr i32 @_CGet.Optional.Core.9a253b43086de47c(ptr %self) #0 !dbg !44 {
// CHECK:STDOUT: %1 = call i32 @"_CGet.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899"(ptr %self), !dbg !47
// CHECK:STDOUT: ret i32 %1, !dbg !48
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: ; Function Attrs: nounwind
// CHECK:STDOUT: define linkonce_odr i1 @"_CHas.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899"(ptr %value) #0 !dbg !42 {
// CHECK:STDOUT: %has_value = getelementptr inbounds nuw { i32, i1 }, ptr %value, i32 0, i32 1, !dbg !43
// CHECK:STDOUT: %1 = load i8, ptr %has_value, align 1, !dbg !43
// CHECK:STDOUT: %2 = trunc i8 %1 to i1, !dbg !43
// CHECK:STDOUT: ret i1 %2, !dbg !44
// CHECK:STDOUT: define linkonce_odr void @"_COp.Int.Core:Inc.Core.be1e879c1ad406d8"(ptr %self) #0 !dbg !49 {
// CHECK:STDOUT: call void @"_COp:thunk.Int.Core:AddAssignWith.Core.dbc952efa35fc763"(ptr %self, i32 1), !dbg !55
// CHECK:STDOUT: ret void, !dbg !56
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: ; Function Attrs: nounwind
// CHECK:STDOUT: define linkonce_odr i32 @"_CGet.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899"(ptr %value) #0 !dbg !45 {
// CHECK:STDOUT: %value1 = getelementptr inbounds nuw { i32, i1 }, ptr %value, i32 0, i32 0, !dbg !46
// CHECK:STDOUT: %1 = load i32, ptr %value1, align 4, !dbg !46
// CHECK:STDOUT: ret i32 %1, !dbg !47
// CHECK:STDOUT: define linkonce_odr void @_CSome.Optional.Core.9a253b43086de47c(ptr sret({ i32, i1 }) %return, i32 %value) #0 !dbg !57 {
// CHECK:STDOUT: call void @"_CSome.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899"(ptr %return, i32 %value), !dbg !62
// CHECK:STDOUT: ret void, !dbg !63
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: ; Function Attrs: nounwind
// CHECK:STDOUT: define linkonce_odr void @_CNone.Optional.Core.9a253b43086de47c(ptr sret({ i32, i1 }) %return) #0 !dbg !64 {
// CHECK:STDOUT: call void @"_CNone.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899"(ptr %return), !dbg !67
// CHECK:STDOUT: ret void, !dbg !68
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: ; Function Attrs: nounwind
// CHECK:STDOUT: define linkonce_odr i1 @"_CHas.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899"(ptr %value) #0 !dbg !69 {
// CHECK:STDOUT: %has_value = getelementptr inbounds nuw { i32, i1 }, ptr %value, i32 0, i32 1, !dbg !72
// CHECK:STDOUT: %1 = load i8, ptr %has_value, align 1, !dbg !72
// CHECK:STDOUT: %2 = trunc i8 %1 to i1, !dbg !72
// CHECK:STDOUT: ret i1 %2, !dbg !73
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: ; Function Attrs: nounwind
// CHECK:STDOUT: define linkonce_odr i32 @"_CGet.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899"(ptr %value) #0 !dbg !74 {
// CHECK:STDOUT: %value1 = getelementptr inbounds nuw { i32, i1 }, ptr %value, i32 0, i32 0, !dbg !77
// CHECK:STDOUT: %1 = load i32, ptr %value1, align 4, !dbg !77
// CHECK:STDOUT: ret i32 %1, !dbg !78
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: ; Function Attrs: alwaysinline nounwind
// CHECK:STDOUT: define linkonce_odr void @"_COp:thunk.Int.Core:AddAssignWith.Core.dbc952efa35fc763"(ptr %self, i32 %other) #3 !dbg !48 {
// CHECK:STDOUT: %1 = call i32 @"_CConvert.02bbc8f98b95ea6d:ImplicitAs.Core.5854fed63e66a74b"(i32 %other), !dbg !49
// CHECK:STDOUT: %2 = load i32, ptr %self, align 4, !dbg !50
// CHECK:STDOUT: %3 = add i32 %2, %1, !dbg !50
// CHECK:STDOUT: store i32 %3, ptr %self, align 4, !dbg !50
// CHECK:STDOUT: ret void, !dbg !50
// CHECK:STDOUT: define linkonce_odr void @"_COp:thunk.Int.Core:AddAssignWith.Core.dbc952efa35fc763"(ptr %self, i32 %other) #3 !dbg !79 {
// CHECK:STDOUT: %1 = call i32 @"_CConvert.02bbc8f98b95ea6d:ImplicitAs.Core.5854fed63e66a74b"(i32 %other), !dbg !85
// CHECK:STDOUT: %2 = load i32, ptr %self, align 4, !dbg !86
// CHECK:STDOUT: %3 = add i32 %2, %1, !dbg !86
// CHECK:STDOUT: store i32 %3, ptr %self, align 4, !dbg !86
// CHECK:STDOUT: ret void, !dbg !86
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: ; Function Attrs: nounwind
// CHECK:STDOUT: define linkonce_odr void @"_CSome.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899"(ptr sret({ i32, i1 }) %return, i32 %self) #0 !dbg !51 {
// CHECK:STDOUT: %value = getelementptr inbounds nuw { i32, i1 }, ptr %return, i32 0, i32 0, !dbg !52
// CHECK:STDOUT: store i32 %self, ptr %value, align 4, !dbg !52
// CHECK:STDOUT: %has_value = getelementptr inbounds nuw { i32, i1 }, ptr %return, i32 0, i32 1, !dbg !53
// CHECK:STDOUT: store i8 1, ptr %has_value, align 1, !dbg !53
// CHECK:STDOUT: ret void, !dbg !54
// CHECK:STDOUT: define linkonce_odr void @"_CSome.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899"(ptr sret({ i32, i1 }) %return, i32 %self) #0 !dbg !87 {
// CHECK:STDOUT: %value = getelementptr inbounds nuw { i32, i1 }, ptr %return, i32 0, i32 0, !dbg !90
// CHECK:STDOUT: store i32 %self, ptr %value, align 4, !dbg !90
// CHECK:STDOUT: %has_value = getelementptr inbounds nuw { i32, i1 }, ptr %return, i32 0, i32 1, !dbg !91
// CHECK:STDOUT: store i8 1, ptr %has_value, align 1, !dbg !91
// CHECK:STDOUT: ret void, !dbg !92
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: ; Function Attrs: nounwind
// CHECK:STDOUT: define linkonce_odr void @"_CNone.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899"(ptr sret({ i32, i1 }) %return) #0 !dbg !55 {
// CHECK:STDOUT: %has_value = getelementptr inbounds nuw { i32, i1 }, ptr %return, i32 0, i32 1, !dbg !56
// CHECK:STDOUT: store i8 0, ptr %has_value, align 1, !dbg !56
// CHECK:STDOUT: ret void, !dbg !57
// CHECK:STDOUT: define linkonce_odr void @"_CNone.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899"(ptr sret({ i32, i1 }) %return) #0 !dbg !93 {
// CHECK:STDOUT: %has_value = getelementptr inbounds nuw { i32, i1 }, ptr %return, i32 0, i32 1, !dbg !94
// CHECK:STDOUT: store i8 0, ptr %has_value, align 1, !dbg !94
// CHECK:STDOUT: ret void, !dbg !95
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: ; Function Attrs: nounwind
// CHECK:STDOUT: define linkonce_odr i32 @"_CConvert.02bbc8f98b95ea6d:ImplicitAs.Core.5854fed63e66a74b"(i32 %self) #0 !dbg !58 {
// CHECK:STDOUT: ret i32 %self, !dbg !60
// CHECK:STDOUT: define linkonce_odr i32 @"_CConvert.02bbc8f98b95ea6d:ImplicitAs.Core.5854fed63e66a74b"(i32 %self) #0 !dbg !96 {
// CHECK:STDOUT: ret i32 %self, !dbg !102
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: ; uselistorder directives
@@ -183,58 +183,100 @@ fn F() {
// CHECK:STDOUT: !3 = !DIFile(filename: "iterate.carbon", directory: "")
// CHECK:STDOUT: !4 = distinct !DISubprogram(name: "F", linkageName: "_CF.Main", scope: null, file: !3, line: 15, type: !5, spFlags: DISPFlagDefinition, unit: !2)
// CHECK:STDOUT: !5 = !DISubroutineType(types: !6)
// CHECK:STDOUT: !6 = !{}
// CHECK:STDOUT: !6 = !{null}
// CHECK:STDOUT: !7 = !DILocation(line: 16, column: 26, scope: !4)
// CHECK:STDOUT: !8 = !DILocation(line: 17, column: 7, scope: !4)
// CHECK:STDOUT: !9 = !DILocation(line: 18, column: 5, scope: !4)
// CHECK:STDOUT: !10 = !DILocation(line: 17, column: 3, scope: !4)
// CHECK:STDOUT: !11 = !DILocation(line: 15, column: 1, scope: !4)
// CHECK:STDOUT: !12 = distinct !DISubprogram(name: "NewCursor", linkageName: "_CNewCursor.f06e388f4a5bd5ec:Iterate.Core.a21f6adcc8abe06c", scope: null, file: !13, line: 23, type: !5, spFlags: DISPFlagDefinition, unit: !2)
// CHECK:STDOUT: !12 = distinct !DISubprogram(name: "NewCursor", linkageName: "_CNewCursor.f06e388f4a5bd5ec:Iterate.Core.a21f6adcc8abe06c", scope: null, file: !13, line: 23, type: !14, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !18)
// CHECK:STDOUT: !13 = !DIFile(filename: "{{.*}}/prelude/iterate.carbon", directory: "")
// CHECK:STDOUT: !14 = !DILocation(line: 23, column: 39, scope: !12)
// CHECK:STDOUT: !15 = distinct !DISubprogram(name: "Next", linkageName: "_CNext.f06e388f4a5bd5ec:Iterate.Core.a21f6adcc8abe06c", scope: null, file: !13, line: 24, type: !5, spFlags: DISPFlagDefinition, unit: !2)
// CHECK:STDOUT: !16 = !DILocation(line: 25, column: 9, scope: !15)
// CHECK:STDOUT: !17 = !DILocation(line: 25, column: 8, scope: !15)
// CHECK:STDOUT: !18 = !DILocation(line: 26, column: 7, scope: !15)
// CHECK:STDOUT: !19 = !DILocation(line: 27, column: 36, scope: !15)
// CHECK:STDOUT: !20 = !DILocation(line: 27, column: 31, scope: !15)
// CHECK:STDOUT: !21 = !DILocation(line: 27, column: 14, scope: !15)
// CHECK:STDOUT: !22 = !DILocation(line: 27, column: 7, scope: !15)
// CHECK:STDOUT: !23 = !DILocation(line: 29, column: 14, scope: !15)
// CHECK:STDOUT: !24 = !DILocation(line: 29, column: 7, scope: !15)
// CHECK:STDOUT: !25 = distinct !DISubprogram(name: "HasValue", linkageName: "_CHasValue.Optional.Core.9a253b43086de47c", scope: null, file: !26, line: 32, type: !5, spFlags: DISPFlagDefinition, unit: !2)
// CHECK:STDOUT: !26 = !DIFile(filename: "{{.*}}/prelude/types/optional.carbon", directory: "")
// CHECK:STDOUT: !27 = !DILocation(line: 33, column: 12, scope: !25)
// CHECK:STDOUT: !28 = !DILocation(line: 33, column: 5, scope: !25)
// CHECK:STDOUT: !29 = distinct !DISubprogram(name: "Get", linkageName: "_CGet.Optional.Core.9a253b43086de47c", scope: null, file: !26, line: 35, type: !5, spFlags: DISPFlagDefinition, unit: !2)
// CHECK:STDOUT: !30 = !DILocation(line: 36, column: 12, scope: !29)
// CHECK:STDOUT: !31 = !DILocation(line: 36, column: 5, scope: !29)
// CHECK:STDOUT: !32 = distinct !DISubprogram(name: "Op", linkageName: "_COp.Int.Core:Inc.Core.be1e879c1ad406d8", scope: null, file: !33, line: 339, type: !5, spFlags: DISPFlagDefinition, unit: !2)
// CHECK:STDOUT: !33 = !DIFile(filename: "{{.*}}/prelude/types/int.carbon", directory: "")
// CHECK:STDOUT: !34 = !DILocation(line: 341, column: 5, scope: !32)
// CHECK:STDOUT: !35 = !DILocation(line: 339, column: 3, scope: !32)
// CHECK:STDOUT: !36 = distinct !DISubprogram(name: "Some", linkageName: "_CSome.Optional.Core.9a253b43086de47c", scope: null, file: !26, line: 29, type: !5, spFlags: DISPFlagDefinition, unit: !2)
// CHECK:STDOUT: !37 = !DILocation(line: 30, column: 12, scope: !36)
// CHECK:STDOUT: !38 = !DILocation(line: 30, column: 5, scope: !36)
// CHECK:STDOUT: !39 = distinct !DISubprogram(name: "None", linkageName: "_CNone.Optional.Core.9a253b43086de47c", scope: null, file: !26, line: 26, type: !5, spFlags: DISPFlagDefinition, unit: !2)
// CHECK:STDOUT: !40 = !DILocation(line: 27, column: 12, scope: !39)
// CHECK:STDOUT: !41 = !DILocation(line: 27, column: 5, scope: !39)
// CHECK:STDOUT: !42 = distinct !DISubprogram(name: "Has", linkageName: "_CHas.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899", scope: null, file: !26, line: 112, type: !5, spFlags: DISPFlagDefinition, unit: !2)
// CHECK:STDOUT: !43 = !DILocation(line: 113, column: 12, scope: !42)
// CHECK:STDOUT: !44 = !DILocation(line: 113, column: 5, scope: !42)
// CHECK:STDOUT: !45 = distinct !DISubprogram(name: "Get", linkageName: "_CGet.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899", scope: null, file: !26, line: 115, type: !5, spFlags: DISPFlagDefinition, unit: !2)
// CHECK:STDOUT: !46 = !DILocation(line: 116, column: 12, scope: !45)
// CHECK:STDOUT: !47 = !DILocation(line: 116, column: 5, scope: !45)
// CHECK:STDOUT: !48 = distinct !DISubprogram(name: "Op", linkageName: "_COp:thunk.Int.Core:AddAssignWith.Core.dbc952efa35fc763", scope: null, file: !33, line: 275, type: !5, spFlags: DISPFlagDefinition, unit: !2)
// CHECK:STDOUT: !49 = !DILocation(line: 4294967295, scope: !48)
// CHECK:STDOUT: !50 = !DILocation(line: 275, column: 3, scope: !48)
// CHECK:STDOUT: !51 = distinct !DISubprogram(name: "Some", linkageName: "_CSome.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899", scope: null, file: !26, line: 104, type: !5, spFlags: DISPFlagDefinition, unit: !2)
// CHECK:STDOUT: !52 = !DILocation(line: 108, column: 5, scope: !51)
// CHECK:STDOUT: !53 = !DILocation(line: 109, column: 5, scope: !51)
// CHECK:STDOUT: !54 = !DILocation(line: 110, column: 5, scope: !51)
// CHECK:STDOUT: !55 = distinct !DISubprogram(name: "None", linkageName: "_CNone.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899", scope: null, file: !26, line: 99, type: !5, spFlags: DISPFlagDefinition, unit: !2)
// CHECK:STDOUT: !56 = !DILocation(line: 101, column: 5, scope: !55)
// CHECK:STDOUT: !57 = !DILocation(line: 102, column: 5, scope: !55)
// CHECK:STDOUT: !58 = distinct !DISubprogram(name: "Convert", linkageName: "_CConvert.02bbc8f98b95ea6d:ImplicitAs.Core.5854fed63e66a74b", scope: null, file: !59, line: 24, type: !5, spFlags: DISPFlagDefinition, unit: !2)
// CHECK:STDOUT: !59 = !DIFile(filename: "{{.*}}/prelude/operators/as.carbon", directory: "")
// CHECK:STDOUT: !60 = !DILocation(line: 24, column: 38, scope: !58)
// CHECK:STDOUT: !14 = !DISubroutineType(types: !15)
// CHECK:STDOUT: !15 = !{!16, !17}
// CHECK:STDOUT: !16 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
// CHECK:STDOUT: !17 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 8)
// CHECK:STDOUT: !18 = !{!19}
// CHECK:STDOUT: !19 = !DILocalVariable(arg: 1, scope: !12, type: !17)
// CHECK:STDOUT: !20 = !DILocation(line: 23, column: 39, scope: !12)
// CHECK:STDOUT: !21 = distinct !DISubprogram(name: "Next", linkageName: "_CNext.f06e388f4a5bd5ec:Iterate.Core.a21f6adcc8abe06c", scope: null, file: !13, line: 24, type: !22, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !24)
// CHECK:STDOUT: !22 = !DISubroutineType(types: !23)
// CHECK:STDOUT: !23 = !{!17, !17, !17}
// CHECK:STDOUT: !24 = !{!25, !26}
// CHECK:STDOUT: !25 = !DILocalVariable(arg: 1, scope: !21, type: !17)
// CHECK:STDOUT: !26 = !DILocalVariable(arg: 2, scope: !21, type: !17)
// CHECK:STDOUT: !27 = !DILocation(line: 25, column: 9, scope: !21)
// CHECK:STDOUT: !28 = !DILocation(line: 25, column: 8, scope: !21)
// CHECK:STDOUT: !29 = !DILocation(line: 26, column: 7, scope: !21)
// CHECK:STDOUT: !30 = !DILocation(line: 27, column: 36, scope: !21)
// CHECK:STDOUT: !31 = !DILocation(line: 27, column: 31, scope: !21)
// CHECK:STDOUT: !32 = !DILocation(line: 27, column: 14, scope: !21)
// CHECK:STDOUT: !33 = !DILocation(line: 27, column: 7, scope: !21)
// CHECK:STDOUT: !34 = !DILocation(line: 29, column: 14, scope: !21)
// CHECK:STDOUT: !35 = !DILocation(line: 29, column: 7, scope: !21)
// CHECK:STDOUT: !36 = distinct !DISubprogram(name: "HasValue", linkageName: "_CHasValue.Optional.Core.9a253b43086de47c", scope: null, file: !37, line: 32, type: !38, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !40)
// CHECK:STDOUT: !37 = !DIFile(filename: "{{.*}}/prelude/types/optional.carbon", directory: "")
// CHECK:STDOUT: !38 = !DISubroutineType(types: !39)
// CHECK:STDOUT: !39 = !{!17, !17}
// CHECK:STDOUT: !40 = !{!41}
// CHECK:STDOUT: !41 = !DILocalVariable(arg: 1, scope: !36, type: !17)
// CHECK:STDOUT: !42 = !DILocation(line: 33, column: 12, scope: !36)
// CHECK:STDOUT: !43 = !DILocation(line: 33, column: 5, scope: !36)
// CHECK:STDOUT: !44 = distinct !DISubprogram(name: "Get", linkageName: "_CGet.Optional.Core.9a253b43086de47c", scope: null, file: !37, line: 35, type: !14, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !45)
// CHECK:STDOUT: !45 = !{!46}
// CHECK:STDOUT: !46 = !DILocalVariable(arg: 1, scope: !44, type: !17)
// CHECK:STDOUT: !47 = !DILocation(line: 36, column: 12, scope: !44)
// CHECK:STDOUT: !48 = !DILocation(line: 36, column: 5, scope: !44)
// CHECK:STDOUT: !49 = distinct !DISubprogram(name: "Op", linkageName: "_COp.Int.Core:Inc.Core.be1e879c1ad406d8", scope: null, file: !50, line: 339, type: !51, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !53)
// CHECK:STDOUT: !50 = !DIFile(filename: "{{.*}}/prelude/types/int.carbon", directory: "")
// CHECK:STDOUT: !51 = !DISubroutineType(types: !52)
// CHECK:STDOUT: !52 = !{null, !16}
// CHECK:STDOUT: !53 = !{!54}
// CHECK:STDOUT: !54 = !DILocalVariable(arg: 1, scope: !49, type: !16)
// CHECK:STDOUT: !55 = !DILocation(line: 341, column: 5, scope: !49)
// CHECK:STDOUT: !56 = !DILocation(line: 339, column: 3, scope: !49)
// CHECK:STDOUT: !57 = distinct !DISubprogram(name: "Some", linkageName: "_CSome.Optional.Core.9a253b43086de47c", scope: null, file: !37, line: 29, type: !58, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !60)
// CHECK:STDOUT: !58 = !DISubroutineType(types: !59)
// CHECK:STDOUT: !59 = !{!17, !16}
// CHECK:STDOUT: !60 = !{!61}
// CHECK:STDOUT: !61 = !DILocalVariable(arg: 1, scope: !57, type: !16)
// CHECK:STDOUT: !62 = !DILocation(line: 30, column: 12, scope: !57)
// CHECK:STDOUT: !63 = !DILocation(line: 30, column: 5, scope: !57)
// CHECK:STDOUT: !64 = distinct !DISubprogram(name: "None", linkageName: "_CNone.Optional.Core.9a253b43086de47c", scope: null, file: !37, line: 26, type: !65, spFlags: DISPFlagDefinition, unit: !2)
// CHECK:STDOUT: !65 = !DISubroutineType(types: !66)
// CHECK:STDOUT: !66 = !{!17}
// CHECK:STDOUT: !67 = !DILocation(line: 27, column: 12, scope: !64)
// CHECK:STDOUT: !68 = !DILocation(line: 27, column: 5, scope: !64)
// CHECK:STDOUT: !69 = distinct !DISubprogram(name: "Has", linkageName: "_CHas.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899", scope: null, file: !37, line: 112, type: !38, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !70)
// CHECK:STDOUT: !70 = !{!71}
// CHECK:STDOUT: !71 = !DILocalVariable(arg: 1, scope: !69, type: !17)
// CHECK:STDOUT: !72 = !DILocation(line: 113, column: 12, scope: !69)
// CHECK:STDOUT: !73 = !DILocation(line: 113, column: 5, scope: !69)
// CHECK:STDOUT: !74 = distinct !DISubprogram(name: "Get", linkageName: "_CGet.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899", scope: null, file: !37, line: 115, type: !14, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !75)
// CHECK:STDOUT: !75 = !{!76}
// CHECK:STDOUT: !76 = !DILocalVariable(arg: 1, scope: !74, type: !17)
// CHECK:STDOUT: !77 = !DILocation(line: 116, column: 12, scope: !74)
// CHECK:STDOUT: !78 = !DILocation(line: 116, column: 5, scope: !74)
// CHECK:STDOUT: !79 = distinct !DISubprogram(name: "Op", linkageName: "_COp:thunk.Int.Core:AddAssignWith.Core.dbc952efa35fc763", scope: null, file: !50, line: 275, type: !80, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !82)
// CHECK:STDOUT: !80 = !DISubroutineType(types: !81)
// CHECK:STDOUT: !81 = !{null, !16, !16}
// CHECK:STDOUT: !82 = !{!83, !84}
// CHECK:STDOUT: !83 = !DILocalVariable(arg: 1, scope: !79, type: !16)
// CHECK:STDOUT: !84 = !DILocalVariable(arg: 2, scope: !79, type: !16)
// CHECK:STDOUT: !85 = !DILocation(line: 4294967295, scope: !79)
// CHECK:STDOUT: !86 = !DILocation(line: 275, column: 3, scope: !79)
// CHECK:STDOUT: !87 = distinct !DISubprogram(name: "Some", linkageName: "_CSome.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899", scope: null, file: !37, line: 104, type: !58, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !88)
// CHECK:STDOUT: !88 = !{!89}
// CHECK:STDOUT: !89 = !DILocalVariable(arg: 1, scope: !87, type: !16)
// CHECK:STDOUT: !90 = !DILocation(line: 108, column: 5, scope: !87)
// CHECK:STDOUT: !91 = !DILocation(line: 109, column: 5, scope: !87)
// CHECK:STDOUT: !92 = !DILocation(line: 110, column: 5, scope: !87)
// CHECK:STDOUT: !93 = distinct !DISubprogram(name: "None", linkageName: "_CNone.225258f1a45e9386:OptionalStorage.Core.5450dc8e8b8e0899", scope: null, file: !37, line: 99, type: !65, spFlags: DISPFlagDefinition, unit: !2)
// CHECK:STDOUT: !94 = !DILocation(line: 101, column: 5, scope: !93)
// CHECK:STDOUT: !95 = !DILocation(line: 102, column: 5, scope: !93)
// CHECK:STDOUT: !96 = distinct !DISubprogram(name: "Convert", linkageName: "_CConvert.02bbc8f98b95ea6d:ImplicitAs.Core.5854fed63e66a74b", scope: null, file: !97, line: 24, type: !98, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !100)
// CHECK:STDOUT: !97 = !DIFile(filename: "{{.*}}/prelude/operators/as.carbon", directory: "")
// CHECK:STDOUT: !98 = !DISubroutineType(types: !99)
// CHECK:STDOUT: !99 = !{!16, !16}
// CHECK:STDOUT: !100 = !{!101}
// CHECK:STDOUT: !101 = !DILocalVariable(arg: 1, scope: !96, type: !16)
// CHECK:STDOUT: !102 = !DILocation(line: 24, column: 38, scope: !96)