diff options
author | OCHyams <orlando.hyams@sony.com> | 2019-11-25 09:02:05 +0000 |
---|---|---|
committer | OCHyams <orlando.hyams@sony.com> | 2019-11-25 10:55:14 +0000 |
commit | 2de23c8364babb49fe39d81048cd304a5ac2934e (patch) | |
tree | df5640e86e23a095372c95f72480b92b7dfb6327 /llvm/unittests/Transforms | |
parent | 29b4d8f19e30910c099c5453da258843d6b7869a (diff) | |
download | bcm5719-llvm-2de23c8364babb49fe39d81048cd304a5ac2934e.tar.gz bcm5719-llvm-2de23c8364babb49fe39d81048cd304a5ac2934e.zip |
[DebugInfo@O2][Utils] Undef instead of delete dbg.values in helper func
Summary:
Related bug: https://bugs.llvm.org/show_bug.cgi?id=40648
Static helper function rewriteDebugUsers in Local.cpp deletes dbg.value
intrinsics when it cannot move or rewrite them, or salvage the deleted
instruction's value. It should instead undef them in this case.
This patch fixes that and I've added a test which covers the failing test
case in bz40648. I've updated the unit test Local.ReplaceAllDbgUsesWith
to check for this behaviour (and fixed a typo in the test which would
cause the old test to always pass).
Reviewers: aprantl, vsk, djtodoro, probinson
Reviewed By: vsk
Subscribers: hiraditya, llvm-commits
Tags: #debug-info, #llvm
Differential Revision: https://reviews.llvm.org/D70604
Diffstat (limited to 'llvm/unittests/Transforms')
-rw-r--r-- | llvm/unittests/Transforms/Utils/LocalTest.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/llvm/unittests/Transforms/Utils/LocalTest.cpp b/llvm/unittests/Transforms/Utils/LocalTest.cpp index 1f67a1ec84c..99713d5817f 100644 --- a/llvm/unittests/Transforms/Utils/LocalTest.cpp +++ b/llvm/unittests/Transforms/Utils/LocalTest.cpp @@ -759,11 +759,14 @@ TEST(Local, ReplaceAllDbgUsesWith) { auto *ADbgVal = cast<DbgValueInst>(A.getNextNode()); EXPECT_EQ(ConstantInt::get(A.getType(), 0), ADbgVal->getVariableLocation()); - // Introduce a use-before-def. Check that the dbg.values for %f are deleted. + // Introduce a use-before-def. Check that the dbg.values for %f become undef. EXPECT_TRUE(replaceAllDbgUsesWith(F_, G, G, DT)); + auto *FDbgVal = cast<DbgValueInst>(F_.getNextNode()); + EXPECT_TRUE(isa<UndefValue>(FDbgVal->getVariableLocation())); + SmallVector<DbgValueInst *, 1> FDbgVals; - findDbgValues(FDbgVals, &F); + findDbgValues(FDbgVals, &F_); EXPECT_EQ(0U, FDbgVals.size()); // Simulate i32 -> i64 conversion to test sign-extension. Here are some |