Diego Novillo | f5041ce | 2014-03-03 20:06:11 +0000 | [diff] [blame] | 1 | ; RUN: opt < %s -add-discriminators -S | FileCheck %s |
| 2 | |
| 3 | ; Basic DWARF discriminator test. All the instructions in block |
| 4 | ; 'if.then' should have a different discriminator value than |
| 5 | ; the conditional branch at the end of block 'entry'. |
| 6 | ; |
| 7 | ; Original code: |
| 8 | ; |
| 9 | ; void foo(int i) { |
| 10 | ; int x; |
| 11 | ; if (i < 10) x = i; |
| 12 | ; } |
| 13 | |
| 14 | define void @foo(i32 %i) #0 { |
| 15 | entry: |
| 16 | %i.addr = alloca i32, align 4 |
| 17 | %x = alloca i32, align 4 |
| 18 | store i32 %i, i32* %i.addr, align 4 |
| 19 | %0 = load i32* %i.addr, align 4, !dbg !10 |
| 20 | %cmp = icmp slt i32 %0, 10, !dbg !10 |
| 21 | br i1 %cmp, label %if.then, label %if.end, !dbg !10 |
| 22 | |
| 23 | if.then: ; preds = %entry |
| 24 | %1 = load i32* %i.addr, align 4, !dbg !10 |
| 25 | ; CHECK: %1 = load i32* %i.addr, align 4, !dbg !12 |
| 26 | |
| 27 | store i32 %1, i32* %x, align 4, !dbg !10 |
| 28 | ; CHECK: store i32 %1, i32* %x, align 4, !dbg !12 |
| 29 | |
| 30 | br label %if.end, !dbg !10 |
| 31 | ; CHECK: br label %if.end, !dbg !12 |
| 32 | |
| 33 | if.end: ; preds = %if.then, %entry |
| 34 | ret void, !dbg !12 |
| 35 | } |
| 36 | |
| 37 | attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } |
| 38 | |
| 39 | !llvm.dbg.cu = !{!0} |
| 40 | !llvm.module.flags = !{!7, !8} |
| 41 | !llvm.ident = !{!9} |
| 42 | |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 43 | !0 = !{!"0x11\0012\00clang version 3.5 \000\00\000\00\000", !1, !2, !2, !3, !2, !2} ; [ DW_TAG_compile_unit ] [basic.c] [DW_LANG_C99] |
| 44 | !1 = !{!"basic.c", !"."} |
| 45 | !2 = !{} |
| 46 | !3 = !{!4} |
| 47 | !4 = !{!"0x2e\00foo\00foo\00\001\000\001\000\006\00256\000\001", !1, !5, !6, null, void (i32)* @foo, null, null, !2} ; [ DW_TAG_subprogram ] [line 1] [def] [foo] |
| 48 | !5 = !{!"0x29", !1} ; [ DW_TAG_file_type ] [basic.c] |
| 49 | !6 = !{!"0x15\00\000\000\000\000\000\000", i32 0, null, null, !2, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ] |
| 50 | !7 = !{i32 2, !"Dwarf Version", i32 4} |
| 51 | !8 = !{i32 1, !"Debug Info Version", i32 2} |
| 52 | !9 = !{!"clang version 3.5 "} |
Duncan P. N. Exon Smith | 9885469 | 2015-01-14 22:27:36 +0000 | [diff] [blame] | 53 | !10 = !MDLocation(line: 3, scope: !11) |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 54 | !11 = !{!"0xb\003\000\000", !1, !4} ; [ DW_TAG_lexical_block ] [basic.c] |
Duncan P. N. Exon Smith | 9885469 | 2015-01-14 22:27:36 +0000 | [diff] [blame] | 55 | !12 = !MDLocation(line: 4, scope: !4) |
Diego Novillo | f5041ce | 2014-03-03 20:06:11 +0000 | [diff] [blame] | 56 | |
Duncan P. N. Exon Smith | 9885469 | 2015-01-14 22:27:36 +0000 | [diff] [blame] | 57 | ; CHECK: !12 = !MDLocation(line: 3, scope: !13) |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 58 | ; CHECK: !13 = !{!"0xb\001", !1, !11} ; [ DW_TAG_lexical_block ] [./basic.c] |
Duncan P. N. Exon Smith | 9885469 | 2015-01-14 22:27:36 +0000 | [diff] [blame] | 59 | ; CHECK: !14 = !MDLocation(line: 4, scope: !4) |