Francis Visoiu Mistrih | b7cef81 | 2019-01-14 10:55:55 +0000 | [diff] [blame] | 1 | ; RUN: llc -mtriple=s390x-linux-gnu -frame-pointer=all < %s | FileCheck %s |
| 2 | ; RUN: llc -mtriple=s390x-linux-gnu -frame-pointer=all -filetype=obj < %s \ |
Adrian Prantl | 16aa4cf | 2017-09-11 23:05:20 +0000 | [diff] [blame] | 3 | ; RUN: | llvm-dwarfdump -v -debug-info - | FileCheck --check-prefix=DEBUG %s |
Ulrich Weigand | 08bd615 | 2013-05-06 16:18:29 +0000 | [diff] [blame] | 4 | ; |
| 5 | ; This is a regression test making sure the location of variables is correct in |
| 6 | ; debugging information, even if they're addressed via the frame pointer. |
Richard Sandiford | 9b9e057 | 2014-01-13 15:42:16 +0000 | [diff] [blame] | 7 | ; Originally a copy of the AArch64 test, commandeered for SystemZ. |
Ulrich Weigand | 08bd615 | 2013-05-06 16:18:29 +0000 | [diff] [blame] | 8 | ; |
| 9 | ; First make sure main_arr is where we expect it: %r11 + 164 |
| 10 | ; |
| 11 | ; CHECK: main: |
| 12 | ; CHECK: aghi %r15, -568 |
Richard Sandiford | 891a7e7 | 2013-06-27 09:42:10 +0000 | [diff] [blame] | 13 | ; CHECK: la %r2, 164(%r11) |
Ulrich Weigand | 08bd615 | 2013-05-06 16:18:29 +0000 | [diff] [blame] | 14 | ; CHECK: brasl %r14, populate_array@PLT |
David Blaikie | 2f75351 | 2014-05-23 21:11:46 +0000 | [diff] [blame] | 15 | |
| 16 | ; DEBUG: DW_TAG_variable |
David Blaikie | 2f75351 | 2014-05-23 21:11:46 +0000 | [diff] [blame] | 17 | ; DEBUG-NOT: DW_TAG |
Reid Kleckner | a058736 | 2017-08-29 21:41:21 +0000 | [diff] [blame] | 18 | ; DEBUG: DW_AT_location {{.*}}(DW_OP_fbreg +164) |
David Blaikie | eb1a272 | 2014-06-13 22:18:23 +0000 | [diff] [blame] | 19 | ; DEBUG-NOT: DW_TAG |
| 20 | ; DEBUG: DW_AT_name {{.*}} "main_arr" |
Ulrich Weigand | 08bd615 | 2013-05-06 16:18:29 +0000 | [diff] [blame] | 21 | |
| 22 | |
| 23 | @.str = private unnamed_addr constant [13 x i8] c"Total is %d\0A\00", align 2 |
| 24 | |
| 25 | declare void @populate_array(i32*, i32) nounwind |
| 26 | |
Adrian Prantl | 87b7eb9 | 2014-10-01 18:55:02 +0000 | [diff] [blame] | 27 | declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone |
Ulrich Weigand | 08bd615 | 2013-05-06 16:18:29 +0000 | [diff] [blame] | 28 | |
| 29 | declare i32 @sum_array(i32*, i32) nounwind |
| 30 | |
Peter Collingbourne | d4bff30 | 2015-11-05 22:03:56 +0000 | [diff] [blame] | 31 | define i32 @main() nounwind !dbg !14 { |
Ulrich Weigand | 08bd615 | 2013-05-06 16:18:29 +0000 | [diff] [blame] | 32 | entry: |
| 33 | %retval = alloca i32, align 4 |
| 34 | %main_arr = alloca [100 x i32], align 4 |
| 35 | %val = alloca i32, align 4 |
Richard Sandiford | 9b9e057 | 2014-01-13 15:42:16 +0000 | [diff] [blame] | 36 | store volatile i32 0, i32* %retval |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 37 | call void @llvm.dbg.declare(metadata [100 x i32]* %main_arr, metadata !17, metadata !DIExpression()), !dbg !22 |
| 38 | call void @llvm.dbg.declare(metadata i32* %val, metadata !23, metadata !DIExpression()), !dbg !24 |
David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 39 | %arraydecay = getelementptr inbounds [100 x i32], [100 x i32]* %main_arr, i32 0, i32 0, !dbg !25 |
Ulrich Weigand | 08bd615 | 2013-05-06 16:18:29 +0000 | [diff] [blame] | 40 | call void @populate_array(i32* %arraydecay, i32 100), !dbg !25 |
David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 41 | %arraydecay1 = getelementptr inbounds [100 x i32], [100 x i32]* %main_arr, i32 0, i32 0, !dbg !26 |
Ulrich Weigand | 08bd615 | 2013-05-06 16:18:29 +0000 | [diff] [blame] | 42 | %call = call i32 @sum_array(i32* %arraydecay1, i32 100), !dbg !26 |
| 43 | store i32 %call, i32* %val, align 4, !dbg !26 |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 44 | %0 = load i32, i32* %val, align 4, !dbg !27 |
David Blaikie | 23af648 | 2015-04-16 23:24:18 +0000 | [diff] [blame] | 45 | %call2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i32 0, i32 0), i32 %0), !dbg !27 |
Ulrich Weigand | 08bd615 | 2013-05-06 16:18:29 +0000 | [diff] [blame] | 46 | ret i32 0, !dbg !28 |
| 47 | } |
| 48 | |
| 49 | declare i32 @printf(i8*, ...) |
| 50 | |
| 51 | !llvm.dbg.cu = !{!0} |
Manman Ren | 409558f | 2013-11-22 21:49:45 +0000 | [diff] [blame] | 52 | !llvm.module.flags = !{!30} |
Ulrich Weigand | 08bd615 | 2013-05-06 16:18:29 +0000 | [diff] [blame] | 53 | |
Adrian Prantl | 75819ae | 2016-04-15 15:57:41 +0000 | [diff] [blame] | 54 | !0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.2 ", isOptimized: false, emissionKind: FullDebug, file: !29, enums: !1, retainedTypes: !1, globals: !1, imports: !1) |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 55 | !1 = !{} |
Shiva Chen | 2c86455 | 2018-05-09 02:40:45 +0000 | [diff] [blame] | 56 | !5 = distinct !DISubprogram(name: "populate_array", line: 4, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 4, file: !29, scope: !6, type: !7, retainedNodes: !1) |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 57 | !6 = !DIFile(filename: "simple.c", directory: "/home/timnor01/a64-trunk/build") |
| 58 | !7 = !DISubroutineType(types: !8) |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 59 | !8 = !{null, !9, !10} |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 60 | !9 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !10) |
| 61 | !10 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed) |
Shiva Chen | 2c86455 | 2018-05-09 02:40:45 +0000 | [diff] [blame] | 62 | !11 = distinct !DISubprogram(name: "sum_array", line: 9, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 9, file: !29, scope: !6, type: !12, retainedNodes: !1) |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 63 | !12 = !DISubroutineType(types: !13) |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 64 | !13 = !{!10, !9, !10} |
Shiva Chen | 2c86455 | 2018-05-09 02:40:45 +0000 | [diff] [blame] | 65 | !14 = distinct !DISubprogram(name: "main", line: 18, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 18, file: !29, scope: !6, type: !15, retainedNodes: !1) |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 66 | !15 = !DISubroutineType(types: !16) |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 67 | !16 = !{!10} |
Duncan P. N. Exon Smith | ed013cd | 2015-07-31 18:58:39 +0000 | [diff] [blame] | 68 | !17 = !DILocalVariable(name: "main_arr", line: 19, scope: !18, file: !6, type: !19) |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 69 | !18 = distinct !DILexicalBlock(line: 18, column: 16, file: !29, scope: !14) |
| 70 | !19 = !DICompositeType(tag: DW_TAG_array_type, size: 3200, align: 32, baseType: !10, elements: !{!20}) |
| 71 | !20 = !DISubrange(count: 99) |
| 72 | !22 = !DILocation(line: 19, column: 7, scope: !18) |
Duncan P. N. Exon Smith | ed013cd | 2015-07-31 18:58:39 +0000 | [diff] [blame] | 73 | !23 = !DILocalVariable(name: "val", line: 20, scope: !18, file: !6, type: !10) |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 74 | !24 = !DILocation(line: 20, column: 7, scope: !18) |
| 75 | !25 = !DILocation(line: 22, column: 3, scope: !18) |
| 76 | !26 = !DILocation(line: 23, column: 9, scope: !18) |
| 77 | !27 = !DILocation(line: 24, column: 3, scope: !18) |
| 78 | !28 = !DILocation(line: 26, column: 3, scope: !18) |
| 79 | !29 = !DIFile(filename: "simple.c", directory: "/home/timnor01/a64-trunk/build") |
Duncan P. N. Exon Smith | e274180 | 2015-03-03 17:24:31 +0000 | [diff] [blame] | 80 | !30 = !{i32 1, !"Debug Info Version", i32 3} |