aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/llvm/lib/Transforms/Scalar/ADCE.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm-project/llvm/lib/Transforms/Scalar/ADCE.cpp')
-rw-r--r--contrib/llvm-project/llvm/lib/Transforms/Scalar/ADCE.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/contrib/llvm-project/llvm/lib/Transforms/Scalar/ADCE.cpp b/contrib/llvm-project/llvm/lib/Transforms/Scalar/ADCE.cpp
index 9af275a9f4e2..90b544c89226 100644
--- a/contrib/llvm-project/llvm/lib/Transforms/Scalar/ADCE.cpp
+++ b/contrib/llvm-project/llvm/lib/Transforms/Scalar/ADCE.cpp
@@ -549,6 +549,11 @@ ADCEChanged AggressiveDeadCodeElimination::removeDeadInstructions() {
// like the rest of this loop does. Extending support to assignment tracking
// is future work.
for (DPValue &DPV : make_early_inc_range(I.getDbgValueRange())) {
+ // Avoid removing a DPV that is linked to instructions because it holds
+ // information about an existing store.
+ if (DPV.isDbgAssign())
+ if (!at::getAssignmentInsts(&DPV).empty())
+ continue;
if (AliveScopes.count(DPV.getDebugLoc()->getScope()))
continue;
I.dropOneDbgValue(&DPV);