Sergey Dmitrouk | 46c4f02 | 2015-05-13 08:58:03 +0000 | [diff] [blame] | 1 | ; RUN: llc -filetype=asm -asm-verbose=0 < %s | FileCheck %s |
| 2 | |
| 3 | ; int main() |
| 4 | ; { |
| 5 | ; int x = 0; |
| 6 | ; if (x > 0) |
| 7 | ; return x; |
| 8 | ; x = -1; // <== this line should have correct debug location |
| 9 | ; return -1; |
| 10 | ; } |
| 11 | |
| 12 | ; CHECK: .loc 1 6 7 |
James Molloy | a33571c | 2016-09-11 09:13:32 +0000 | [diff] [blame] | 13 | ; CHECK: mvn |
Sergey Dmitrouk | 46c4f02 | 2015-05-13 08:58:03 +0000 | [diff] [blame] | 14 | |
| 15 | target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64" |
| 16 | target triple = "armv7--linux-gnueabihf" |
| 17 | |
| 18 | ; Function Attrs: nounwind |
Peter Collingbourne | d4bff30 | 2015-11-05 22:03:56 +0000 | [diff] [blame] | 19 | define i32 @main() !dbg !4 { |
Sergey Dmitrouk | 46c4f02 | 2015-05-13 08:58:03 +0000 | [diff] [blame] | 20 | entry: |
| 21 | %retval = alloca i32, align 4 |
| 22 | %x = alloca i32, align 4 |
| 23 | store i32 0, i32* %retval |
| 24 | call void @llvm.dbg.declare(metadata i32* %x, metadata !10, metadata !11), !dbg !12 |
| 25 | store i32 0, i32* %x, align 4, !dbg !12 |
| 26 | %0 = load i32, i32* %x, align 4, !dbg !13 |
| 27 | %cmp = icmp sgt i32 %0, 0, !dbg !15 |
| 28 | br i1 %cmp, label %if.then, label %if.end, !dbg !16 |
| 29 | |
| 30 | if.then: ; preds = %entry |
| 31 | %1 = load i32, i32* %x, align 4, !dbg !17 |
| 32 | store i32 %1, i32* %retval, !dbg !18 |
| 33 | br label %return, !dbg !18 |
| 34 | |
| 35 | if.end: ; preds = %entry |
| 36 | store i32 -1, i32* %x, align 4, !dbg !19 |
| 37 | store i32 -1, i32* %retval, !dbg !20 |
| 38 | br label %return, !dbg !20 |
| 39 | |
| 40 | return: ; preds = %if.end, %if.then |
| 41 | %2 = load i32, i32* %retval, !dbg !21 |
| 42 | ret i32 %2, !dbg !21 |
| 43 | } |
| 44 | |
| 45 | ; Function Attrs: nounwind readnone |
| 46 | declare void @llvm.dbg.declare(metadata, metadata, metadata) |
| 47 | |
| 48 | !llvm.dbg.cu = !{!0} |
| 49 | !llvm.module.flags = !{!8, !9} |
| 50 | |
Adrian Prantl | 75819ae | 2016-04-15 15:57:41 +0000 | [diff] [blame] | 51 | !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "", isOptimized: false, emissionKind: FullDebug) |
Sergey Dmitrouk | 46c4f02 | 2015-05-13 08:58:03 +0000 | [diff] [blame] | 52 | !1 = !DIFile(filename: "test.c", directory: "/home/user/clang/build") |
| 53 | !2 = !{} |
Adrian Prantl | 75819ae | 2016-04-15 15:57:41 +0000 | [diff] [blame] | 54 | !4 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 1, type: !5, isLocal: false, isDefinition: true, scopeLine: 2, isOptimized: false, unit: !0, variables: !2) |
Sergey Dmitrouk | 46c4f02 | 2015-05-13 08:58:03 +0000 | [diff] [blame] | 55 | !5 = !DISubroutineType(types: !6) |
| 56 | !6 = !{!7} |
| 57 | !7 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed) |
| 58 | !8 = !{i32 2, !"Dwarf Version", i32 4} |
| 59 | !9 = !{i32 2, !"Debug Info Version", i32 3} |
Duncan P. N. Exon Smith | ed013cd | 2015-07-31 18:58:39 +0000 | [diff] [blame] | 60 | !10 = !DILocalVariable(name: "x", scope: !4, file: !1, line: 3, type: !7) |
Sergey Dmitrouk | 46c4f02 | 2015-05-13 08:58:03 +0000 | [diff] [blame] | 61 | !11 = !DIExpression() |
| 62 | !12 = !DILocation(line: 3, column: 9, scope: !4) |
| 63 | !13 = !DILocation(line: 4, column: 9, scope: !14) |
| 64 | !14 = distinct !DILexicalBlock(scope: !4, file: !1, line: 4, column: 9) |
| 65 | !15 = !DILocation(line: 4, column: 11, scope: !14) |
| 66 | !16 = !DILocation(line: 4, column: 9, scope: !4) |
| 67 | !17 = !DILocation(line: 5, column: 13, scope: !14) |
| 68 | !18 = !DILocation(line: 5, column: 9, scope: !14) |
| 69 | !19 = !DILocation(line: 6, column: 7, scope: !4) |
| 70 | !20 = !DILocation(line: 7, column: 5, scope: !4) |
| 71 | !21 = !DILocation(line: 8, column: 1, scope: !4) |