mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 12:12:47 +01:00
[PruneEH] Unify invoke and call handling in DeleteBasicBlock
No functionality change is intended. llvm-svn: 258610
This commit is contained in:
parent
0728f4a41f
commit
09858a3961
@ -231,11 +231,15 @@ void PruneEH::DeleteBasicBlock(BasicBlock *BB) {
|
||||
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()));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user