diff options
author | Markus Lavin <markus.lavin@ericsson.com> | 2019-03-19 09:17:28 +0000 |
---|---|---|
committer | Markus Lavin <markus.lavin@ericsson.com> | 2019-03-19 09:17:28 +0000 |
commit | ad78768d5933bfa50009e8b6f84150291a8aba8f (patch) | |
tree | 1a90ef53cc92f803791ebeaa3169aae516048b52 /llvm/lib/Transforms/Utils/Local.cpp | |
parent | d2f2f33ef2d071ba535e57b1637ebd9cc3206d51 (diff) | |
download | bcm5719-llvm-ad78768d5933bfa50009e8b6f84150291a8aba8f.tar.gz bcm5719-llvm-ad78768d5933bfa50009e8b6f84150291a8aba8f.zip |
Revert "[DebugInfo] Introduce DW_OP_LLVM_convert"
This reverts commit 1cf4b593a7ebd666fc6775f3bd38196e8e65fafe.
Build bots found failing tests not detected locally.
Failing Tests (3):
LLVM :: DebugInfo/Generic/convert-debugloc.ll
LLVM :: DebugInfo/Generic/convert-inlined.ll
LLVM :: DebugInfo/Generic/convert-linked.ll
llvm-svn: 356444
Diffstat (limited to 'llvm/lib/Transforms/Utils/Local.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/Local.cpp | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp index 9271e1dda5a..d14384fe576 100644 --- a/llvm/lib/Transforms/Utils/Local.cpp +++ b/llvm/lib/Transforms/Utils/Local.cpp @@ -1861,10 +1861,21 @@ bool llvm::replaceAllDbgUsesWith(Instruction &From, Value &To, return None; bool Signed = *Signedness == DIBasicType::Signedness::Signed; - dwarf::TypeKind TK = Signed ? dwarf::DW_ATE_signed : dwarf::DW_ATE_unsigned; - SmallVector<uint64_t, 8> Ops({dwarf::DW_OP_LLVM_convert, ToBits, TK, - dwarf::DW_OP_LLVM_convert, FromBits, TK}); - return DIExpression::appendToStack(DII.getExpression(), Ops); + + if (!Signed) { + // In the unsigned case, assume that a debugger will initialize the + // high bits to 0 and do a no-op conversion. + return Identity(DII); + } else { + // In the signed case, the high bits are given by sign extension, i.e: + // (To >> (ToBits - 1)) * ((2 ^ FromBits) - 1) + // Calculate the high bits and OR them together with the low bits. + SmallVector<uint64_t, 8> Ops({dwarf::DW_OP_dup, dwarf::DW_OP_constu, + (ToBits - 1), dwarf::DW_OP_shr, + dwarf::DW_OP_lit0, dwarf::DW_OP_not, + dwarf::DW_OP_mul, dwarf::DW_OP_or}); + return DIExpression::appendToStack(DII.getExpression(), Ops); + } }; return rewriteDebugUsers(From, To, DomPoint, DT, SignOrZeroExt); } |