13
13
class A {
14
14
var v: array (i32 , 2 );
15
15
16
- // TODO: The LLVM IR we create for this crashes LLVM instruction selection.
17
- // The gep indexes are completely bogus.
18
16
fn Init () - > A { return {.v = (1 , 2 )}; }
19
17
20
18
fn Access[self: Self]() - > i32 {
@@ -30,34 +28,34 @@ class A {
30
28
// CHECK:STDOUT: ; ModuleID = 'field.carbon'
31
29
// CHECK:STDOUT: source_filename = "field.carbon"
32
30
// CHECK:STDOUT:
33
- // CHECK:STDOUT: @A.val.loc18_40 = internal constant { [2 x i32] } { [2 x i32] [i32 1, i32 2] }
31
+ // CHECK:STDOUT: @A.val.loc16_40 = internal constant { [2 x i32] } { [2 x i32] [i32 1, i32 2] }
34
32
// CHECK:STDOUT:
35
33
// CHECK:STDOUT: define void @_CInit.A.Main(ptr sret({ [2 x i32] }) %return) !dbg !4 {
36
34
// CHECK:STDOUT: entry:
37
- // CHECK:STDOUT: %.loc18_39 .2.v = getelementptr inbounds nuw { [2 x i32] }, ptr %return, i32 0, i32 0, !dbg !7
38
- // CHECK:STDOUT: %.loc18_38 .3.array.index = getelementptr inbounds [2 x i32], ptr %.loc18_39 .2.v, i32 0, i64 0, !dbg !8
39
- // CHECK:STDOUT: %.loc18_38 .6.array.index = getelementptr inbounds [2 x i32], ptr %.loc18_39 .2.v, i32 0, i64 1, !dbg !8
40
- // CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %return, ptr align 4 @A.val.loc18_40 , i64 8, i1 false), !dbg !9
35
+ // CHECK:STDOUT: %.loc16_39 .2.v = getelementptr inbounds nuw { [2 x i32] }, ptr %return, i32 0, i32 0, !dbg !7
36
+ // CHECK:STDOUT: %.loc16_38 .3.array.index = getelementptr inbounds [2 x i32], ptr %.loc16_39 .2.v, i32 0, i64 0, !dbg !8
37
+ // CHECK:STDOUT: %.loc16_38 .6.array.index = getelementptr inbounds [2 x i32], ptr %.loc16_39 .2.v, i32 0, i64 1, !dbg !8
38
+ // 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
41
39
// CHECK:STDOUT: ret void, !dbg !9
42
40
// CHECK:STDOUT: }
43
41
// CHECK:STDOUT:
44
42
// CHECK:STDOUT: define i32 @_CAccess.A.Main(ptr %self) !dbg !10 {
45
43
// CHECK:STDOUT: entry:
46
- // CHECK:STDOUT: %.loc21_16 .1.v = getelementptr inbounds nuw { [2 x i32] }, ptr %self, i32 0, i32 0, !dbg !11
47
- // CHECK:STDOUT: %.loc21_20 .2.array.index = getelementptr inbounds [2 x i32], ptr %.loc21_16 .1.v, i32 0, i32 0, !dbg !11
48
- // CHECK:STDOUT: %.loc21_20 .3 = load i32, ptr %.loc21_20 .2.array.index, align 4, !dbg !11
49
- // CHECK:STDOUT: ret i32 %.loc21_20 .3, !dbg !12
44
+ // CHECK:STDOUT: %.loc19_16 .1.v = getelementptr inbounds nuw { [2 x i32] }, ptr %self, i32 0, i32 0, !dbg !11
45
+ // CHECK:STDOUT: %.loc19_20 .2.array.index = getelementptr inbounds [2 x i32], ptr %.loc19_16 .1.v, i32 0, i32 0, !dbg !11
46
+ // CHECK:STDOUT: %.loc19_20 .3 = load i32, ptr %.loc19_20 .2.array.index, align 4, !dbg !11
47
+ // CHECK:STDOUT: ret i32 %.loc19_20 .3, !dbg !12
50
48
// CHECK:STDOUT: }
51
49
// CHECK:STDOUT:
52
50
// CHECK:STDOUT: define i32 @_CUse.A.Main(ptr %self) !dbg !13 {
53
51
// CHECK:STDOUT: entry:
54
- // CHECK:STDOUT: %.loc25_9 .2.v = getelementptr inbounds nuw { [2 x i32] }, ptr %self, i32 0, i32 0, !dbg !14
55
- // CHECK:STDOUT: %.loc25_14 .array.index = getelementptr inbounds [2 x i32], ptr %.loc25_9 .2.v, i32 0, i32 0, !dbg !14
56
- // CHECK:STDOUT: store i32 1, ptr %.loc25_14 .array.index, align 4, !dbg !14
57
- // CHECK:STDOUT: %.loc26_16 .2.v = getelementptr inbounds nuw { [2 x i32] }, ptr %self, i32 0, i32 0, !dbg !15
58
- // CHECK:STDOUT: %.loc26_21 .1.array.index = getelementptr inbounds [2 x i32], ptr %.loc26_16 .2.v, i32 0, i32 1, !dbg !15
59
- // CHECK:STDOUT: %.loc26_21 .2 = load i32, ptr %.loc26_21 .1.array.index, align 4, !dbg !15
60
- // CHECK:STDOUT: ret i32 %.loc26_21 .2, !dbg !16
52
+ // CHECK:STDOUT: %.loc23_9 .2.v = getelementptr inbounds nuw { [2 x i32] }, ptr %self, i32 0, i32 0, !dbg !14
53
+ // CHECK:STDOUT: %.loc23_14 .array.index = getelementptr inbounds [2 x i32], ptr %.loc23_9 .2.v, i32 0, i32 0, !dbg !14
54
+ // CHECK:STDOUT: store i32 1, ptr %.loc23_14 .array.index, align 4, !dbg !14
55
+ // CHECK:STDOUT: %.loc24_16 .2.v = getelementptr inbounds nuw { [2 x i32] }, ptr %self, i32 0, i32 0, !dbg !15
56
+ // CHECK:STDOUT: %.loc24_21 .1.array.index = getelementptr inbounds [2 x i32], ptr %.loc24_16 .2.v, i32 0, i32 1, !dbg !15
57
+ // CHECK:STDOUT: %.loc24_21 .2 = load i32, ptr %.loc24_21 .1.array.index, align 4, !dbg !15
58
+ // CHECK:STDOUT: ret i32 %.loc24_21 .2, !dbg !16
61
59
// CHECK:STDOUT: }
62
60
// CHECK:STDOUT:
63
61
// CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
@@ -72,16 +70,16 @@ class A {
72
70
// CHECK:STDOUT: !1 = !{i32 2, !"Debug Info Version", i32 3}
73
71
// CHECK:STDOUT: !2 = distinct !DICompileUnit(language: DW_LANG_C, file: !3, producer: "carbon", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug)
74
72
// CHECK:STDOUT: !3 = !DIFile(filename: "field.carbon", directory: "")
75
- // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "Init", linkageName: "_CInit.A.Main", scope: null, file: !3, line: 18 , type: !5, spFlags: DISPFlagDefinition, unit: !2)
73
+ // CHECK:STDOUT: !4 = distinct !DISubprogram(name: "Init", linkageName: "_CInit.A.Main", scope: null, file: !3, line: 16 , type: !5, spFlags: DISPFlagDefinition, unit: !2)
76
74
// CHECK:STDOUT: !5 = !DISubroutineType(types: !6)
77
75
// CHECK:STDOUT: !6 = !{}
78
- // CHECK:STDOUT: !7 = !DILocation(line: 18 , column: 27, scope: !4)
79
- // CHECK:STDOUT: !8 = !DILocation(line: 18 , column: 33, scope: !4)
80
- // CHECK:STDOUT: !9 = !DILocation(line: 18 , column: 20, scope: !4)
81
- // CHECK:STDOUT: !10 = distinct !DISubprogram(name: "Access", linkageName: "_CAccess.A.Main", scope: null, file: !3, line: 20 , type: !5, spFlags: DISPFlagDefinition, unit: !2)
82
- // CHECK:STDOUT: !11 = !DILocation(line: 21 , column: 12, scope: !10)
83
- // CHECK:STDOUT: !12 = !DILocation(line: 21 , column: 5, scope: !10)
84
- // CHECK:STDOUT: !13 = distinct !DISubprogram(name: "Use", linkageName: "_CUse.A.Main", scope: null, file: !3, line: 24 , type: !5, spFlags: DISPFlagDefinition, unit: !2)
85
- // CHECK:STDOUT: !14 = !DILocation(line: 25 , column: 5, scope: !13)
86
- // CHECK:STDOUT: !15 = !DILocation(line: 26 , column: 12, scope: !13)
87
- // CHECK:STDOUT: !16 = !DILocation(line: 26 , column: 5, scope: !13)
76
+ // CHECK:STDOUT: !7 = !DILocation(line: 16 , column: 27, scope: !4)
77
+ // CHECK:STDOUT: !8 = !DILocation(line: 16 , column: 33, scope: !4)
78
+ // CHECK:STDOUT: !9 = !DILocation(line: 16 , column: 20, scope: !4)
79
+ // CHECK:STDOUT: !10 = distinct !DISubprogram(name: "Access", linkageName: "_CAccess.A.Main", scope: null, file: !3, line: 18 , type: !5, spFlags: DISPFlagDefinition, unit: !2)
80
+ // CHECK:STDOUT: !11 = !DILocation(line: 19 , column: 12, scope: !10)
81
+ // CHECK:STDOUT: !12 = !DILocation(line: 19 , column: 5, scope: !10)
82
+ // CHECK:STDOUT: !13 = distinct !DISubprogram(name: "Use", linkageName: "_CUse.A.Main", scope: null, file: !3, line: 22 , type: !5, spFlags: DISPFlagDefinition, unit: !2)
83
+ // CHECK:STDOUT: !14 = !DILocation(line: 23 , column: 5, scope: !13)
84
+ // CHECK:STDOUT: !15 = !DILocation(line: 24 , column: 12, scope: !13)
85
+ // CHECK:STDOUT: !16 = !DILocation(line: 24 , column: 5, scope: !13)
0 commit comments