Ekaterina Romanova | 90ff20d | 2014-12-12 05:11:47 +0000 | [diff] [blame] | 1 | ; REQUIRES: object-emission |
| 2 | ; This test is failing for powerpc64, because a location list for the |
| 3 | ; variable 'c' is not generated at all. Temporary marking this test as XFAIL |
| 4 | ; for powerpc, until PR21881 is fixed. |
| 5 | ; XFAIL: powerpc64 |
| 6 | |
| 7 | ; RUN: %llc_dwarf -O2 -dwarf-version 2 -filetype=obj < %s | llvm-dwarfdump - | FileCheck %s --check-prefix=DWARF23 |
| 8 | ; RUN: %llc_dwarf -O2 -dwarf-version 3 -filetype=obj < %s | llvm-dwarfdump - | FileCheck %s --check-prefix=DWARF23 |
| 9 | ; RUN: %llc_dwarf -O2 -dwarf-version 4 -filetype=obj < %s | llvm-dwarfdump - | FileCheck %s --check-prefix=DWARF4 |
| 10 | |
| 11 | ; This is a test for PR21176. |
| 12 | ; DW_OP_const <const> doesn't describe a constant value, but a value at a constant address. |
| 13 | ; The proper way to describe a constant value is DW_OP_constu <const>, DW_OP_stack_value. |
| 14 | |
| 15 | ; Generated with clang -S -emit-llvm -g -O2 test.cpp |
| 16 | |
| 17 | ; extern int func(); |
| 18 | ; |
| 19 | ; int main() |
| 20 | ; { |
| 21 | ; volatile int c = 13; |
| 22 | ; c = func(); |
| 23 | ; return c; |
| 24 | ; } |
| 25 | |
| 26 | ; DWARF23: Location description: 10 0d {{$}} |
| 27 | ; DWARF4: Location description: 10 0d 9f |
| 28 | |
| 29 | ; Function Attrs: uwtable |
| 30 | define i32 @main() #0 { |
| 31 | entry: |
| 32 | %c = alloca i32, align 4 |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 33 | tail call void @llvm.dbg.value(metadata i32 13, i64 0, metadata !10, metadata !16), !dbg !17 |
Ekaterina Romanova | 90ff20d | 2014-12-12 05:11:47 +0000 | [diff] [blame] | 34 | store volatile i32 13, i32* %c, align 4, !dbg !18 |
| 35 | %call = tail call i32 @_Z4funcv(), !dbg !19 |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 36 | tail call void @llvm.dbg.value(metadata i32 %call, i64 0, metadata !10, metadata !16), !dbg !17 |
Ekaterina Romanova | 90ff20d | 2014-12-12 05:11:47 +0000 | [diff] [blame] | 37 | store volatile i32 %call, i32* %c, align 4, !dbg !19 |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 38 | tail call void @llvm.dbg.value(metadata i32* %c, i64 0, metadata !10, metadata !16), !dbg !17 |
Ekaterina Romanova | 90ff20d | 2014-12-12 05:11:47 +0000 | [diff] [blame] | 39 | %c.0.c.0. = load volatile i32* %c, align 4, !dbg !20 |
| 40 | ret i32 %c.0.c.0., !dbg !20 |
| 41 | } |
| 42 | |
| 43 | declare i32 @_Z4funcv() #1 |
| 44 | |
| 45 | ; Function Attrs: nounwind readnone |
| 46 | declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #2 |
| 47 | |
| 48 | attributes #0 = { uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } |
| 49 | attributes #1 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } |
| 50 | attributes #2 = { nounwind readnone } |
| 51 | |
| 52 | !llvm.dbg.cu = !{!0} |
| 53 | !llvm.module.flags = !{!12, !13} |
| 54 | !llvm.ident = !{!14} |
| 55 | |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 56 | !0 = !{!"0x11\004\00clang version 3.6.0 (trunk 223522)\001\00\000\00\001", !1, !2, !2, !3, !2, !2} ; [ DW_TAG_compile_unit ] [/home/kromanova/ngh/ToT_latest/llvm/test/DebugInfo/test.cpp] [DW_LANG_C_plus_plus] |
| 57 | !1 = !{!"test.cpp", !"/home/kromanova/ngh/ToT_latest/llvm/test/DebugInfo"} |
| 58 | !2 = !{} |
| 59 | !3 = !{!4} |
| 60 | !4 = !{!"0x2e\00main\00main\00\003\000\001\000\000\00256\001\004", !1, !5, !6, null, i32 ()* @main, null, null, !9} ; [ DW_TAG_subprogram ] [line 3] [def] [scope 4] [main] |
| 61 | !5 = !{!"0x29", !1} ; [ DW_TAG_file_type ] [/home/kromanova/ngh/ToT_latest/llvm/test/DebugInfo/test.cpp] |
| 62 | !6 = !{!"0x15\00\000\000\000\000\000\000", null, null, null, !7, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ] |
| 63 | !7 = !{!8} |
| 64 | !8 = !{!"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] |
| 65 | !9 = !{!10} |
| 66 | !10 = !{!"0x100\00c\005\000", !4, !5, !11} ; [ DW_TAG_auto_variable ] [c] [line 5] |
| 67 | !11 = !{!"0x35\00\000\000\000\000\000", null, null, !8} ; [ DW_TAG_volatile_type ] [line 0, size 0, align 0, offset 0] [from int] |
| 68 | !12 = !{i32 2, !"Dwarf Version", i32 2} |
| 69 | !13 = !{i32 2, !"Debug Info Version", i32 2} |
| 70 | !14 = !{!"clang version 3.6.0 (trunk 223522)"} |
| 71 | !15 = !{i32 13} |
| 72 | !16 = !{!"0x102"} ; [ DW_TAG_expression ] |
Duncan P. N. Exon Smith | 9885469 | 2015-01-14 22:27:36 +0000 | [diff] [blame^] | 73 | !17 = !MDLocation(line: 5, column: 16, scope: !4) |
| 74 | !18 = !MDLocation(line: 5, column: 3, scope: !4) |
| 75 | !19 = !MDLocation(line: 6, column: 7, scope: !4) |
| 76 | !20 = !MDLocation(line: 7, column: 3, scope: !4) |
Ekaterina Romanova | 90ff20d | 2014-12-12 05:11:47 +0000 | [diff] [blame] | 77 | |