diff options
author | stozer <stephen.tozer@sony.com> | 2019-12-17 09:37:17 +0000 |
---|---|---|
committer | stozer <stephen.tozer@sony.com> | 2019-12-18 11:09:18 +0000 |
commit | bb1b0bc4e57428ce364d3d6c075ff03cb8973462 (patch) | |
tree | 94b07c626e27d7f5000cf1c316dfc6d6c600c8e4 /llvm/test/DebugInfo | |
parent | bc5b7e21e32b23603f4d6148adeb88cd34dd287e (diff) | |
download | bcm5719-llvm-bb1b0bc4e57428ce364d3d6c075ff03cb8973462.tar.gz bcm5719-llvm-bb1b0bc4e57428ce364d3d6c075ff03cb8973462.zip |
[DebugInfo] Correctly handle salvaged casts and split fragments at ISel
Previously, LLVM had no functional way of performing casts inside of a
DIExpression(), which made salvaging cast instructions other than Noop
casts impossible. This patch enables the salvaging of casts by using the
DW_OP_LLVM_convert operator for SExt and Trunc instructions.
There is another issue which is exposed by this fix, in which fragment
DIExpressions (which are preserved more readily by this patch) for
values that must be split across registers in ISel trigger an assertion,
as the 'split' fragments extend beyond the bounds of the fragment
DIExpression causing an error. This patch also fixes this issue by
checking the fragment status of DIExpressions which are to be split, and
dropping fragments that are invalid.
Diffstat (limited to 'llvm/test/DebugInfo')
-rw-r--r-- | llvm/test/DebugInfo/X86/dbg-value-dropped-instcombine.ll | 4 | ||||
-rw-r--r-- | llvm/test/DebugInfo/salvage-cast-debug-info.ll | 25 |
2 files changed, 27 insertions, 2 deletions
diff --git a/llvm/test/DebugInfo/X86/dbg-value-dropped-instcombine.ll b/llvm/test/DebugInfo/X86/dbg-value-dropped-instcombine.ll index 18e51b6fabd..46f940e11c6 100644 --- a/llvm/test/DebugInfo/X86/dbg-value-dropped-instcombine.ll +++ b/llvm/test/DebugInfo/X86/dbg-value-dropped-instcombine.ll @@ -21,8 +21,8 @@ ; } ; CHECK: define dso_local i64 @foo -; CHECK: @llvm.dbg.value({{.*}}, metadata ![[BEE:[0-9]+]], metadata !DIExpression(DW_OP_LLVM_fragment, 0, 32)), -; CHECK: @llvm.dbg.value(metadata i32 undef, metadata ![[BEE]], metadata !DIExpression(DW_OP_LLVM_fragment, 32, 32)), +; CHECK: @llvm.dbg.value(metadata i64 {{.*}}, metadata ![[BEE:[0-9]+]], metadata !DIExpression(DW_OP_LLVM_fragment, 0, 32)), +; CHECK: @llvm.dbg.value(metadata i64 {{.*}}, metadata ![[BEE]], metadata !DIExpression({{.*}}, DW_OP_LLVM_fragment, 32, 32)), target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-unknown" diff --git a/llvm/test/DebugInfo/salvage-cast-debug-info.ll b/llvm/test/DebugInfo/salvage-cast-debug-info.ll new file mode 100644 index 00000000000..f39ac46a66a --- /dev/null +++ b/llvm/test/DebugInfo/salvage-cast-debug-info.ll @@ -0,0 +1,25 @@ +; RUN: opt %s -debugify -early-cse -S | FileCheck %s +define i32 @foo(i64 %nose, i32 %more) { +; CHECK-LABEL: @foo( +; CHECK: call void @llvm.dbg.value(metadata i64 %nose, metadata [[V1:![0-9]+]], metadata !DIExpression(DW_OP_LLVM_convert, 64, DW_ATE_unsigned, DW_OP_LLVM_convert, 32, DW_ATE_unsigned +; CHECK: call void @llvm.dbg.value(metadata i64 %nose.shift, metadata [[V2:![0-9]+]] +; CHECK: call void @llvm.dbg.value(metadata i64 %nose.shift, metadata [[V3:![0-9]+]], metadata !DIExpression(DW_OP_LLVM_convert, 64, DW_ATE_unsigned, DW_OP_LLVM_convert, 32, DW_ATE_unsigned + +entry: + %nose.trunc = trunc i64 %nose to i32 + %nose.shift = lshr i64 %nose, 32 + %nose.trunc.2 = trunc i64 %nose.shift to i32 + %add = add nsw i32 %more, 1 + ret i32 %add +} + +!llvm.module.flags = !{!0, !1} +!llvm.ident = !{!2} + +!0 = !{i32 1, !"wchar_size", i32 2} +!1 = !{i32 7, !"PIC Level", i32 2} +!2 = !{!"clang version 10.0.0 "} + +; CHECK: [[V1]] = !DILocalVariable( +; CHECK: [[V2]] = !DILocalVariable( +; CHECK: [[V3]] = !DILocalVariable( |