Ulrich Weigand | 08bd615 | 2013-05-06 16:18:29 +0000 | [diff] [blame] | 1 | ; RUN: llc -mtriple=s390x-linux-gnu -disable-fp-elim < %s | FileCheck %s |
David Blaikie | 2f75351 | 2014-05-23 21:11:46 +0000 | [diff] [blame] | 2 | ; RUN: llc -mtriple=s390x-linux-gnu -disable-fp-elim -filetype=obj < %s \ |
| 3 | ; RUN: | llvm-dwarfdump -debug-dump=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 | ; Rather hard-coded, but 0x91 => DW_OP_fbreg and 0xa401 is SLEB128 encoded 164. |
| 18 | ; DEBUG-NOT: DW_TAG |
| 19 | ; DEBUG: DW_AT_location {{.*}}(<0x3> 91 a4 01 ) |
David Blaikie | eb1a272 | 2014-06-13 22:18:23 +0000 | [diff] [blame] | 20 | ; DEBUG-NOT: DW_TAG |
| 21 | ; DEBUG: DW_AT_name {{.*}} "main_arr" |
Ulrich Weigand | 08bd615 | 2013-05-06 16:18:29 +0000 | [diff] [blame] | 22 | |
| 23 | |
| 24 | @.str = private unnamed_addr constant [13 x i8] c"Total is %d\0A\00", align 2 |
| 25 | |
| 26 | declare void @populate_array(i32*, i32) nounwind |
| 27 | |
Adrian Prantl | 87b7eb9 | 2014-10-01 18:55:02 +0000 | [diff] [blame] | 28 | declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone |
Ulrich Weigand | 08bd615 | 2013-05-06 16:18:29 +0000 | [diff] [blame] | 29 | |
| 30 | declare i32 @sum_array(i32*, i32) nounwind |
| 31 | |
| 32 | define i32 @main() nounwind { |
| 33 | entry: |
| 34 | %retval = alloca i32, align 4 |
| 35 | %main_arr = alloca [100 x i32], align 4 |
| 36 | %val = alloca i32, align 4 |
Richard Sandiford | 9b9e057 | 2014-01-13 15:42:16 +0000 | [diff] [blame] | 37 | store volatile i32 0, i32* %retval |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame^] | 38 | call void @llvm.dbg.declare(metadata [100 x i32]* %main_arr, metadata !17, metadata !{!"0x102"}), !dbg !22 |
| 39 | call void @llvm.dbg.declare(metadata i32* %val, metadata !23, metadata !{!"0x102"}), !dbg !24 |
Ulrich Weigand | 08bd615 | 2013-05-06 16:18:29 +0000 | [diff] [blame] | 40 | %arraydecay = getelementptr inbounds [100 x i32]* %main_arr, i32 0, i32 0, !dbg !25 |
| 41 | call void @populate_array(i32* %arraydecay, i32 100), !dbg !25 |
| 42 | %arraydecay1 = getelementptr inbounds [100 x i32]* %main_arr, i32 0, i32 0, !dbg !26 |
| 43 | %call = call i32 @sum_array(i32* %arraydecay1, i32 100), !dbg !26 |
| 44 | store i32 %call, i32* %val, align 4, !dbg !26 |
| 45 | %0 = load i32* %val, align 4, !dbg !27 |
| 46 | %call2 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([13 x i8]* @.str, i32 0, i32 0), i32 %0), !dbg !27 |
| 47 | ret i32 0, !dbg !28 |
| 48 | } |
| 49 | |
| 50 | declare i32 @printf(i8*, ...) |
| 51 | |
| 52 | !llvm.dbg.cu = !{!0} |
Manman Ren | 409558f | 2013-11-22 21:49:45 +0000 | [diff] [blame] | 53 | !llvm.module.flags = !{!30} |
Ulrich Weigand | 08bd615 | 2013-05-06 16:18:29 +0000 | [diff] [blame] | 54 | |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame^] | 55 | !0 = !{!"0x11\0012\00clang version 3.2 \000\00\000\00\000", !29, !1, !1, !3, !1, !1} ; [ DW_TAG_compile_unit ] [/home/timnor01/a64-trunk/build/simple.c] [DW_LANG_C99] |
| 56 | !1 = !{} |
| 57 | !3 = !{!5, !11, !14} |
| 58 | !5 = !{!"0x2e\00populate_array\00populate_array\00\004\000\001\000\006\00256\000\004", !29, !6, !7, null, void (i32*, i32)* @populate_array, null, null, !1} ; [ DW_TAG_subprogram ] [line 4] [def] [populate_array] |
| 59 | !6 = !{!"0x29", !29} ; [ DW_TAG_file_type ] |
| 60 | !7 = !{!"0x15\00\000\000\000\000\000\000", i32 0, null, null, !8, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ] |
| 61 | !8 = !{null, !9, !10} |
| 62 | !9 = !{!"0xf\00\000\0064\0064\000\000", null, null, !10} ; [ DW_TAG_pointer_type ] [line 0, size 64, align 64, offset 0] [from int] |
| 63 | !10 = !{!"0x24\00int\000\0032\0032\000\000\005", null, null} ; [ DW_TAG_base_type ] [int] [line 0, size 32, align 32, offset 0, enc DW_ATE_signed] |
| 64 | !11 = !{!"0x2e\00sum_array\00sum_array\00\009\000\001\000\006\00256\000\009", !29, !6, !12, null, i32 (i32*, i32)* @sum_array, null, null, !1} ; [ DW_TAG_subprogram ] [line 9] [def] [sum_array] |
| 65 | !12 = !{!"0x15\00\000\000\000\000\000\000", i32 0, null, null, !13, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ] |
| 66 | !13 = !{!10, !9, !10} |
| 67 | !14 = !{!"0x2e\00main\00main\00\0018\000\001\000\006\00256\000\0018", !29, !6, !15, null, i32 ()* @main, null, null, !1} ; [ DW_TAG_subprogram ] [line 18] [def] [main] |
| 68 | !15 = !{!"0x15\00\000\000\000\000\000\000", i32 0, null, null, !16, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ] |
| 69 | !16 = !{!10} |
| 70 | !17 = !{!"0x100\00main_arr\0019\000", !18, !6, !19} ; [ DW_TAG_auto_variable ] [main_arr] [line 19] |
| 71 | !18 = !{!"0xb\0018\0016\004", !29, !14} ; [ DW_TAG_lexical_block ] [/home/timnor01/a64-trunk/build/simple.c] |
| 72 | !19 = !{!"0x1\00\000\003200\0032\000\000", null, null, !10, !20, i32 0, null, null, null} ; [ DW_TAG_array_type ] [line 0, size 3200, align 32, offset 0] [from int] |
| 73 | !20 = !{!"0x21\000\0099"} ; [ DW_TAG_subrange_type ] [0, 99] |
| 74 | !22 = !{i32 19, i32 7, !18, null} |
| 75 | !23 = !{!"0x100\00val\0020\000", !18, !6, !10} ; [ DW_TAG_auto_variable ] [val] [line 20] |
| 76 | !24 = !{i32 20, i32 7, !18, null} |
| 77 | !25 = !{i32 22, i32 3, !18, null} |
| 78 | !26 = !{i32 23, i32 9, !18, null} |
| 79 | !27 = !{i32 24, i32 3, !18, null} |
| 80 | !28 = !{i32 26, i32 3, !18, null} |
| 81 | !29 = !{!"simple.c", !"/home/timnor01/a64-trunk/build"} |
| 82 | !30 = !{i32 1, !"Debug Info Version", i32 2} |