Paul Robinson | ac7fe5e | 2016-12-12 20:49:11 +0000 | [diff] [blame] | 1 | ; Verify "no source location" directives appear in appropriate places, |
| 2 | ; but don't appear when we explicitly suppress them. |
| 3 | ; RUN: llc < %s -o - | FileCheck %s |
| 4 | ; RUN: llc < %s -o - -use-unknown-locations=Disable | FileCheck %s --check-prefix=DISABLE |
| 5 | |
| 6 | ; Generated from this .cpp targeting linux using -g |
| 7 | ; and then removed function attributes as clutter. |
| 8 | ; |
| 9 | ; void bar(int *); |
| 10 | ; void baz(int *); |
| 11 | ; # 5 "no-source-loc.cpp" |
| 12 | ; void foo(int x) { |
| 13 | ; int z; |
| 14 | ; if (x) |
| 15 | ; # 20 "include.h" |
| 16 | ; bar(&z); |
| 17 | ; # 10 "no-source-loc.cpp" |
| 18 | ; baz(&z); |
| 19 | ; } |
| 20 | |
| 21 | target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" |
| 22 | target triple = "x86_64-unknown-linux-gnu" |
| 23 | |
| 24 | ; Function Attrs: uwtable |
| 25 | define void @_Z3fooi(i32 %x) !dbg !6 { |
| 26 | entry: |
| 27 | %x.addr = alloca i32, align 4 |
| 28 | %z = alloca i32, align 4 |
| 29 | store i32 %x, i32* %x.addr, align 4 |
| 30 | %0 = load i32, i32* %x.addr, align 4, !dbg !8 |
| 31 | %tobool = icmp ne i32 %0, 0, !dbg !8 |
| 32 | br i1 %tobool, label %if.then, label %if.end, !dbg !8 |
| 33 | |
| 34 | if.then: ; preds = %entry |
| 35 | call void @_Z3barPi(i32* %z), !dbg !9 |
| 36 | br label %if.end, !dbg !9 |
| 37 | |
| 38 | if.end: ; preds = %if.then, %entry |
| 39 | call void @_Z3bazPi(i32* %z), !dbg !12 |
| 40 | ret void, !dbg !14 |
| 41 | } |
| 42 | |
Matthias Braun | c7efb6f | 2018-10-11 23:37:58 +0000 | [diff] [blame] | 43 | ; CHECK: .loc 1 7 7 |
Paul Robinson | ac7fe5e | 2016-12-12 20:49:11 +0000 | [diff] [blame] | 44 | ; CHECK-NOT: .loc |
Matthias Braun | c7efb6f | 2018-10-11 23:37:58 +0000 | [diff] [blame] | 45 | ; CHECK: .loc 1 0 7 is_stmt 0 |
Paul Robinson | ac7fe5e | 2016-12-12 20:49:11 +0000 | [diff] [blame] | 46 | ; CHECK-NOT: .loc |
Matthias Braun | c7efb6f | 2018-10-11 23:37:58 +0000 | [diff] [blame] | 47 | ; CHECK: .loc 2 20 5 is_stmt 1 |
Paul Robinson | ac7fe5e | 2016-12-12 20:49:11 +0000 | [diff] [blame] | 48 | ; CHECK: .LBB0_2: |
Matthias Braun | c7efb6f | 2018-10-11 23:37:58 +0000 | [diff] [blame] | 49 | ; CHECK-NEXT: .loc 2 0 5 is_stmt 0 |
| 50 | ; CHECK-NOT: .loc |
| 51 | ; CHECK: .loc 1 10 3 is_stmt 1 |
Paul Robinson | ac7fe5e | 2016-12-12 20:49:11 +0000 | [diff] [blame] | 52 | ; |
| 53 | ; DISABLE-NOT: .loc 1 0 |
| 54 | |
| 55 | declare void @_Z3barPi(i32*) |
| 56 | |
| 57 | declare void @_Z3bazPi(i32*) |
| 58 | |
| 59 | !llvm.dbg.cu = !{!0} |
| 60 | !llvm.module.flags = !{!3, !4} |
| 61 | !llvm.ident = !{!5} |
| 62 | |
| 63 | !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 4.0.0 (trunk 278782)", isOptimized: false, runtimeVersion: 0, emissionKind: LineTablesOnly, enums: !2) |
| 64 | !1 = !DIFile(filename: "no-source-loc.cpp", directory: "/tests") |
| 65 | !2 = !{} |
| 66 | !3 = !{i32 2, !"Dwarf Version", i32 4} |
| 67 | !4 = !{i32 2, !"Debug Info Version", i32 3} |
| 68 | !5 = !{!"clang version 4.0.0 (trunk 278782)"} |
Shiva Chen | 2c86455 | 2018-05-09 02:40:45 +0000 | [diff] [blame] | 69 | !6 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 5, type: !7, isLocal: false, isDefinition: true, scopeLine: 5, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2) |
Paul Robinson | ac7fe5e | 2016-12-12 20:49:11 +0000 | [diff] [blame] | 70 | !7 = !DISubroutineType(types: !2) |
| 71 | !8 = !DILocation(line: 7, column: 7, scope: !6) |
| 72 | !9 = !DILocation(line: 20, column: 5, scope: !10) |
| 73 | !10 = !DILexicalBlockFile(scope: !6, file: !11, discriminator: 0) |
| 74 | !11 = !DIFile(filename: "include.h", directory: "/tests") |
| 75 | !12 = !DILocation(line: 10, column: 3, scope: !13) |
| 76 | !13 = !DILexicalBlockFile(scope: !6, file: !1, discriminator: 0) |
| 77 | !14 = !DILocation(line: 11, column: 1, scope: !13) |