diff options
author | Sergey Dmitrouk <sdmitrouk@accesssoftek.com> | 2015-05-13 08:58:03 +0000 |
---|---|---|
committer | Sergey Dmitrouk <sdmitrouk@accesssoftek.com> | 2015-05-13 08:58:03 +0000 |
commit | 46c4f028484328af676f8413a7ae10b9919da547 (patch) | |
tree | 90177179b9e67c965258610405424670cb681334 /llvm/test | |
parent | 0ad2814c89b3a1033079dc3848e252955897abd6 (diff) | |
download | bcm5719-llvm-46c4f028484328af676f8413a7ae10b9919da547.tar.gz bcm5719-llvm-46c4f028484328af676f8413a7ae10b9919da547.zip |
[DebugInfo] Debug locations for constant SD nodes
Several updates for [DebugInfo] Add debug locations to constant SD nodes (r235989).
Includes:
* re-enabling the change (disabled recently);
* missing change for FP constants;
* resetting debug location of constant node if it's used more than at one place
to prevent emission of wrong locations in case of coalesced constants;
* a couple of additional tests.
Now all look ups in CSEMap are wrapped by additional method.
Comment in D9084 suggests that debug locations aren't useful for "target constants",
so there might be one more change related to this API (namely, dropping debug
locations for getTarget*Constant methods).
Differential Revision: http://reviews.llvm.org/D9604
llvm-svn: 237237
Diffstat (limited to 'llvm/test')
6 files changed, 150 insertions, 6 deletions
diff --git a/llvm/test/DebugInfo/AArch64/constant-dbgloc.ll b/llvm/test/DebugInfo/AArch64/constant-dbgloc.ll index 56e2868c637..a71b869f536 100644 --- a/llvm/test/DebugInfo/AArch64/constant-dbgloc.ll +++ b/llvm/test/DebugInfo/AArch64/constant-dbgloc.ll @@ -1,6 +1,4 @@ ; RUN: llc -filetype=asm %s -o - | FileCheck %s -; XFAIL: * -; disabled until constant coalescing is resolved target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64" target triple = "aarch64--linux-gnueabihf" diff --git a/llvm/test/DebugInfo/ARM/constant-dbgloc.ll b/llvm/test/DebugInfo/ARM/constant-dbgloc.ll index 590b67ec8d0..c4a5703f3e8 100644 --- a/llvm/test/DebugInfo/ARM/constant-dbgloc.ll +++ b/llvm/test/DebugInfo/ARM/constant-dbgloc.ll @@ -1,6 +1,4 @@ ; RUN: llc -filetype=asm %s -o - | FileCheck %s -; XFAIL: * -; disabled until constant coalescing is resolved target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64" target triple = "armv7--linux-gnueabihf" diff --git a/llvm/test/DebugInfo/ARM/multiple-constant-uses-drops-dbgloc.ll b/llvm/test/DebugInfo/ARM/multiple-constant-uses-drops-dbgloc.ll new file mode 100644 index 00000000000..e68c5b82416 --- /dev/null +++ b/llvm/test/DebugInfo/ARM/multiple-constant-uses-drops-dbgloc.ll @@ -0,0 +1,54 @@ +; RUN: llc -filetype=asm -asm-verbose=0 < %s | FileCheck %s + +; char ch; +; int b; +; +; void proc (void) +; { +; ch = 'A'; +; b = 0; // <== this should have correct location +; } + +; CHECK: .loc 1 7 7 +; CHECK: mov r{{[0-9]}}, #0 + +target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64" +target triple = "armv7--linux-gnueabihf" + +@ch = common global i8 0, align 1 +@b = common global i32 0, align 4 + +; Function Attrs: nounwind +define void @proc() #0 { +entry: + store i8 65, i8* @ch, align 1, !dbg !17 + store i32 0, i32* @b, align 4, !dbg !18 + ret void, !dbg !19 +} + +attributes #0 = { nounwind "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" "target-cpu"="cortex-a8" "target-features"="+neon,+vfp3" "unsafe-fp-math"="false" "use-soft-float"="false" } + +!llvm.dbg.cu = !{!0} +!llvm.module.flags = !{!12, !13, !14, !15} +!llvm.ident = !{!16} + +!0 = !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "", isOptimized: false, subprograms: !3) +!1 = !DIFile(filename: "test.c", directory: "/home/user/clang/build") +!2 = !{} +!3 = !{!4} +!4 = !DISubprogram(name: "proc", scope: !1, file: !1, line: 4, type: !5, isLocal: false, isDefinition: true, scopeLine: 5, flags: DIFlagPrototyped, isOptimized: false, function: void ()* @proc, variables: !2) +!5 = !DISubroutineType(types: !6) +!6 = !{null} +!7 = !{!8, !10} +!8 = !DIGlobalVariable(name: "ch", scope: !0, file: !1, line: 1, type: !9, isLocal: false, isDefinition: true, variable: i8* @ch) +!9 = !DIBasicType(name: "char", size: 8, align: 8, encoding: DW_ATE_unsigned_char) +!10 = !DIGlobalVariable(name: "b", scope: !0, file: !1, line: 2, type: !11, isLocal: false, isDefinition: true, variable: i32* @b) +!11 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed) +!12 = !{i32 2, !"Dwarf Version", i32 4} +!13 = !{i32 2, !"Debug Info Version", i32 3} +!14 = !{i32 1, !"wchar_size", i32 4} +!15 = !{i32 1, !"min_enum_size", i32 4} +!16 = !{!"clang version 3.7.0 (http://llvm.org/git/clang.git 9b0abb9df531ef7928c8182120e1869affca17d5) (http://llvm.org/git/llvm.git b1e759524dd94f7ce1e24935daed8383927e96c1)"} +!17 = !DILocation(line: 6, column: 8, scope: !4) +!18 = !DILocation(line: 7, column: 7, scope: !4) +!19 = !DILocation(line: 8, column: 1, scope: !4) diff --git a/llvm/test/DebugInfo/ARM/single-constant-use-preserves-dbgloc.ll b/llvm/test/DebugInfo/ARM/single-constant-use-preserves-dbgloc.ll new file mode 100644 index 00000000000..396eb4fe194 --- /dev/null +++ b/llvm/test/DebugInfo/ARM/single-constant-use-preserves-dbgloc.ll @@ -0,0 +1,72 @@ +; RUN: llc -filetype=asm -asm-verbose=0 < %s | FileCheck %s + +; int main() +; { +; int x = 0; +; if (x > 0) +; return x; +; x = -1; // <== this line should have correct debug location +; return -1; +; } + +; CHECK: .loc 1 6 7 +; CHECK: mvn + +target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64" +target triple = "armv7--linux-gnueabihf" + +; Function Attrs: nounwind +define i32 @main() { +entry: + %retval = alloca i32, align 4 + %x = alloca i32, align 4 + store i32 0, i32* %retval + call void @llvm.dbg.declare(metadata i32* %x, metadata !10, metadata !11), !dbg !12 + store i32 0, i32* %x, align 4, !dbg !12 + %0 = load i32, i32* %x, align 4, !dbg !13 + %cmp = icmp sgt i32 %0, 0, !dbg !15 + br i1 %cmp, label %if.then, label %if.end, !dbg !16 + +if.then: ; preds = %entry + %1 = load i32, i32* %x, align 4, !dbg !17 + store i32 %1, i32* %retval, !dbg !18 + br label %return, !dbg !18 + +if.end: ; preds = %entry + store i32 -1, i32* %x, align 4, !dbg !19 + store i32 -1, i32* %retval, !dbg !20 + br label %return, !dbg !20 + +return: ; preds = %if.end, %if.then + %2 = load i32, i32* %retval, !dbg !21 + ret i32 %2, !dbg !21 +} + +; Function Attrs: nounwind readnone +declare void @llvm.dbg.declare(metadata, metadata, metadata) + +!llvm.dbg.cu = !{!0} +!llvm.module.flags = !{!8, !9} + +!0 = !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "", isOptimized: false, subprograms: !3) +!1 = !DIFile(filename: "test.c", directory: "/home/user/clang/build") +!2 = !{} +!3 = !{!4} +!4 = !DISubprogram(name: "main", scope: !1, file: !1, line: 1, type: !5, isLocal: false, isDefinition: true, scopeLine: 2, isOptimized: false, function: i32 ()* @main, variables: !2) +!5 = !DISubroutineType(types: !6) +!6 = !{!7} +!7 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed) +!8 = !{i32 2, !"Dwarf Version", i32 4} +!9 = !{i32 2, !"Debug Info Version", i32 3} +!10 = !DILocalVariable(tag: DW_TAG_auto_variable, name: "x", scope: !4, file: !1, line: 3, type: !7) +!11 = !DIExpression() +!12 = !DILocation(line: 3, column: 9, scope: !4) +!13 = !DILocation(line: 4, column: 9, scope: !14) +!14 = distinct !DILexicalBlock(scope: !4, file: !1, line: 4, column: 9) +!15 = !DILocation(line: 4, column: 11, scope: !14) +!16 = !DILocation(line: 4, column: 9, scope: !4) +!17 = !DILocation(line: 5, column: 13, scope: !14) +!18 = !DILocation(line: 5, column: 9, scope: !14) +!19 = !DILocation(line: 6, column: 7, scope: !4) +!20 = !DILocation(line: 7, column: 5, scope: !4) +!21 = !DILocation(line: 8, column: 1, scope: !4) diff --git a/llvm/test/DebugInfo/constant-sdnodes-have-dbg-location.ll b/llvm/test/DebugInfo/constant-sdnodes-have-dbg-location.ll index 6bfd51b4c18..1f502a2a262 100644 --- a/llvm/test/DebugInfo/constant-sdnodes-have-dbg-location.ll +++ b/llvm/test/DebugInfo/constant-sdnodes-have-dbg-location.ll @@ -1,7 +1,5 @@ ; RUN: llc -debug < %s 2>&1 | FileCheck %s ; REQUIRES: asserts -; XFAIL: * -; disabled until constant coalescing is resolved ; CHECK: 0x{{[0-9,a-f]+}}: i32 = Constant<-1>test.c:4:5 diff --git a/llvm/test/DebugInfo/constantfp-sdnodes-have-dbg-location.ll b/llvm/test/DebugInfo/constantfp-sdnodes-have-dbg-location.ll new file mode 100644 index 00000000000..2f7ecd8b061 --- /dev/null +++ b/llvm/test/DebugInfo/constantfp-sdnodes-have-dbg-location.ll @@ -0,0 +1,24 @@ +; RUN: llc -debug < %s 2>&1 | FileCheck %s +; REQUIRES: asserts + +; CHECK: 0x{{[0-9,a-f]+}}: f64 = ConstantFP<1.500000e+00>test.c:3:5 + +define double @f() { +entry: + ret double 1.500000e+00, !dbg !10 +} + +!llvm.dbg.cu = !{!0} +!llvm.module.flags = !{!8, !9} + +!0 = !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "", isOptimized: false, subprograms: !3) +!1 = !DIFile(filename: "test.c", directory: "/home/user/clang-llvm/build") +!2 = !{} +!3 = !{!4} +!4 = !DISubprogram(name: "f", scope: !1, file: !1, line: 1, type: !5, isLocal: false, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: false, function: double ()* @f, variables: !2) +!5 = !DISubroutineType(types: !6) +!6 = !{!7} +!7 = !DIBasicType(name: "double", size: 64, align: 64, encoding: DW_ATE_float) +!8 = !{i32 2, !"Dwarf Version", i32 4} +!9 = !{i32 2, !"Debug Info Version", i32 3} +!10 = !DILocation(line: 3, column: 5, scope: !4) |