[llvm-commits] [llvm] r130431 - /llvm/trunk/lib/Transforms/Utils/Local.cpp
Devang Patel
dpatel at apple.com
Thu Apr 28 13:32:02 PDT 2011
Author: dpatel
Date: Thu Apr 28 15:32:02 2011
New Revision: 130431
URL: http://llvm.org/viewvc/llvm-project?rev=130431&view=rev
Log:
Remove DbgDeclare only if all uses are converted.
Modified:
llvm/trunk/lib/Transforms/Utils/Local.cpp
Modified: llvm/trunk/lib/Transforms/Utils/Local.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/Local.cpp?rev=130431&r1=130430&r2=130431&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/Local.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/Local.cpp Thu Apr 28 15:32:02 2011
@@ -838,14 +838,18 @@
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;
}
More information about the llvm-commits
mailing list