summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Utils/Local.cpp
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2011-04-28 20:32:02 +0000
committerDevang Patel <dpatel@apple.com>2011-04-28 20:32:02 +0000
commit72aa1a8a68130a94a161224e8037a0f8c54ddfa8 (patch)
treea33860d9c958c1a9691065e57eca6edd01490c57 /llvm/lib/Transforms/Utils/Local.cpp
parent367342e20920e533e63b06b3803e7be5609ac52d (diff)
downloadbcm5719-llvm-72aa1a8a68130a94a161224e8037a0f8c54ddfa8.tar.gz
bcm5719-llvm-72aa1a8a68130a94a161224e8037a0f8c54ddfa8.zip
Remove DbgDeclare only if all uses are converted.
llvm-svn: 130431
Diffstat (limited to 'llvm/lib/Transforms/Utils/Local.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/Local.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp
index 614e4114e9c..4bca2fc1fb9 100644
--- a/llvm/lib/Transforms/Utils/Local.cpp
+++ b/llvm/lib/Transforms/Utils/Local.cpp
@@ -838,14 +838,18 @@ bool llvm::LowerDbgDeclare(Function &F) {
E = Dbgs.end(); I != E; ++I) {
DbgDeclareInst *DDI = *I;
if (AllocaInst *AI = dyn_cast_or_null<AllocaInst>(DDI->getAddress())) {
+ bool RemoveDDI = true;
for (Value::use_iterator UI = AI->use_begin(), E = AI->use_end();
UI != E; ++UI)
if (StoreInst *SI = dyn_cast<StoreInst>(*UI))
ConvertDebugDeclareToDebugValue(DDI, SI, DIB);
else if (LoadInst *LI = dyn_cast<LoadInst>(*UI))
ConvertDebugDeclareToDebugValue(DDI, LI, DIB);
+ else
+ RemoveDDI = false;
+ if (RemoveDDI)
+ DDI->eraseFromParent();
}
- DDI->eraseFromParent();
}
return true;
}
OpenPOWER on IntegriCloud