[llvm] r258610 - [PruneEH] Unify invoke and call handling in DeleteBasicBlock
David Majnemer via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 22 21:41:27 PST 2016
Author: majnemer
Date: Fri Jan 22 23:41:27 2016
New Revision: 258610
URL: http://llvm.org/viewvc/llvm-project?rev=258610&view=rev
Log:
[PruneEH] Unify invoke and call handling in DeleteBasicBlock
No functionality change is intended.
Modified:
llvm/trunk/lib/Transforms/IPO/PruneEH.cpp
Modified: llvm/trunk/lib/Transforms/IPO/PruneEH.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/PruneEH.cpp?rev=258610&r1=258609&r2=258610&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/PruneEH.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/PruneEH.cpp Fri Jan 22 23:41:27 2016
@@ -231,11 +231,15 @@ void PruneEH::DeleteBasicBlock(BasicBloc
CallGraphNode *CGN = CG[BB->getParent()];
for (BasicBlock::iterator I = BB->end(), E = BB->begin(); I != E; ) {
--I;
- if (CallInst *CI = dyn_cast<CallInst>(I)) {
- if (!isa<IntrinsicInst>(I))
- CGN->removeCallEdgeFor(CI);
- } else if (InvokeInst *II = dyn_cast<InvokeInst>(I))
- CGN->removeCallEdgeFor(II);
+
+ if (auto CS = CallSite (&*I)) {
+ const Function *Callee = CS.getCalledFunction();
+ if (!Callee || !Intrinsic::isLeaf(Callee->getIntrinsicID()))
+ CGN->removeCallEdgeFor(CS);
+ else if (!Callee->isIntrinsic())
+ CGN->removeCallEdgeFor(CS);
+ }
+
if (!I->use_empty())
I->replaceAllUsesWith(UndefValue::get(I->getType()));
}
More information about the llvm-commits
mailing list