diff options
author | Devang Patel <dpatel@apple.com> | 2011-03-18 23:28:02 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2011-03-18 23:28:02 +0000 |
commit | c1431e6e84d84c644b4cc19caa3a1b69ada12545 (patch) | |
tree | ad79fd0465d9e0e95e505d376a31298d9666f10a /llvm/lib/Transforms/Utils | |
parent | 1ec7b33079a574db8c87bf5d6754db338be904cd (diff) | |
download | bcm5719-llvm-c1431e6e84d84c644b4cc19caa3a1b69ada12545.tar.gz bcm5719-llvm-c1431e6e84d84c644b4cc19caa3a1b69ada12545.zip |
Consider debug info intrinsics pointing to null value as dead instructions.
llvm-svn: 127922
Diffstat (limited to 'llvm/lib/Transforms/Utils')
-rw-r--r-- | llvm/lib/Transforms/Utils/Local.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp index e54dfb3dc73..19b999722db 100644 --- a/llvm/lib/Transforms/Utils/Local.cpp +++ b/llvm/lib/Transforms/Utils/Local.cpp @@ -211,7 +211,20 @@ bool llvm::ConstantFoldTerminator(BasicBlock *BB) { 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; |