[llvm-commits] [llvm] r127922 - /llvm/trunk/lib/Transforms/Utils/Local.cpp
Devang Patel
dpatel at apple.com
Fri Mar 18 16:28:02 PDT 2011
Author: dpatel
Date: Fri Mar 18 18:28:02 2011
New Revision: 127922
URL: http://llvm.org/viewvc/llvm-project?rev=127922&view=rev
Log:
Consider debug info intrinsics pointing to null value as dead instructions.
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=127922&r1=127921&r2=127922&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/Local.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/Local.cpp Fri Mar 18 18:28:02 2011
@@ -211,7 +211,20 @@
bool llvm::isInstructionTriviallyDead(Instruction *I) {
if (!I->use_empty() || isa<TerminatorInst>(I)) return false;
- // We don't want debug info removed by anything this general.
+ // We don't want debug info removed by anything this general, unless
+ // debug info is empty.
+ if (DbgDeclareInst *DDI = dyn_cast<DbgDeclareInst>(I)) {
+ if (DDI->getAddress())
+ return false;
+ else
+ return true;
+ } else if (DbgValueInst *DVI = dyn_cast<DbgValueInst>(I)) {
+ if (DVI->getValue())
+ return false;
+ else
+ return true;
+ }
+
if (isa<DbgInfoIntrinsic>(I)) return false;
if (!I->mayHaveSideEffects()) return true;
More information about the llvm-commits
mailing list