Skip to content

Commit 83865f2

Browse files
committed
Reenable disabled lower tests.
1 parent 888b74d commit 83865f2

File tree

5 files changed

+545
-320
lines changed

5 files changed

+545
-320
lines changed

toolchain/lower/testdata/array/field.carbon

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
class A {
1414
var v: array(i32, 2);
1515

16-
// TODO: The LLVM IR we create for this crashes LLVM instruction selection.
17-
// The gep indexes are completely bogus.
1816
fn Init() -> A { return {.v = (1, 2)}; }
1917

2018
fn Access[self: Self]() -> i32 {
@@ -30,34 +28,34 @@ class A {
3028
// CHECK:STDOUT: ; ModuleID = 'field.carbon'
3129
// CHECK:STDOUT: source_filename = "field.carbon"
3230
// 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] }
3432
// CHECK:STDOUT:
3533
// CHECK:STDOUT: define void @_CInit.A.Main(ptr sret({ [2 x i32] }) %return) !dbg !4 {
3634
// 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
4139
// CHECK:STDOUT: ret void, !dbg !9
4240
// CHECK:STDOUT: }
4341
// CHECK:STDOUT:
4442
// CHECK:STDOUT: define i32 @_CAccess.A.Main(ptr %self) !dbg !10 {
4543
// 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
5048
// CHECK:STDOUT: }
5149
// CHECK:STDOUT:
5250
// CHECK:STDOUT: define i32 @_CUse.A.Main(ptr %self) !dbg !13 {
5351
// 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
6159
// CHECK:STDOUT: }
6260
// CHECK:STDOUT:
6361
// CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
@@ -72,16 +70,16 @@ class A {
7270
// CHECK:STDOUT: !1 = !{i32 2, !"Debug Info Version", i32 3}
7371
// CHECK:STDOUT: !2 = distinct !DICompileUnit(language: DW_LANG_C, file: !3, producer: "carbon", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug)
7472
// 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)
7674
// CHECK:STDOUT: !5 = !DISubroutineType(types: !6)
7775
// 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

Comments
 (0)