[llvm-commits] [llvm] r66977 - /llvm/trunk/lib/Transforms/IPO/StripSymbols.cpp
Dale Johannesen
dalej at apple.com
Fri Mar 13 15:59:47 PDT 2009
Author: johannes
Date: Fri Mar 13 17:59:47 2009
New Revision: 66977
URL: http://llvm.org/viewvc/llvm-project?rev=66977&view=rev
Log:
Fix -strip-debug-declare to work when there are
llvm.global.variable's but no llvm.declare's.
Modified:
llvm/trunk/lib/Transforms/IPO/StripSymbols.cpp
Modified: llvm/trunk/lib/Transforms/IPO/StripSymbols.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/StripSymbols.cpp?rev=66977&r1=66976&r2=66977&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/StripSymbols.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/StripSymbols.cpp Fri Mar 13 17:59:47 2009
@@ -368,29 +368,27 @@
bool StripDebugDeclare::runOnModule(Module &M) {
Function *Declare = M.getFunction("llvm.dbg.declare");
-
- if (!Declare)
- return false;
-
std::vector<Constant*> DeadConstants;
- while (!Declare->use_empty()) {
- CallInst *CI = cast<CallInst>(Declare->use_back());
- Value *Arg1 = CI->getOperand(1);
- Value *Arg2 = CI->getOperand(2);
- assert(CI->use_empty() && "llvm.dbg intrinsic should have void result");
- CI->eraseFromParent();
- if (Arg1->use_empty()) {
- if (Constant *C = dyn_cast<Constant>(Arg1))
- DeadConstants.push_back(C);
- else
- RecursivelyDeleteTriviallyDeadInstructions(Arg1, NULL);
+ if (Declare) {
+ while (!Declare->use_empty()) {
+ CallInst *CI = cast<CallInst>(Declare->use_back());
+ Value *Arg1 = CI->getOperand(1);
+ Value *Arg2 = CI->getOperand(2);
+ assert(CI->use_empty() && "llvm.dbg intrinsic should have void result");
+ CI->eraseFromParent();
+ if (Arg1->use_empty()) {
+ if (Constant *C = dyn_cast<Constant>(Arg1))
+ DeadConstants.push_back(C);
+ else
+ RecursivelyDeleteTriviallyDeadInstructions(Arg1, NULL);
+ }
+ if (Arg2->use_empty())
+ if (Constant *C = dyn_cast<Constant>(Arg2))
+ DeadConstants.push_back(C);
}
- if (Arg2->use_empty())
- if (Constant *C = dyn_cast<Constant>(Arg2))
- DeadConstants.push_back(C);
+ Declare->eraseFromParent();
}
- Declare->eraseFromParent();
// Delete all llvm.dbg.global_variables.
for (Module::global_iterator I = M.global_begin(), E = M.global_end();
More information about the llvm-commits
mailing list