mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-08 13:26:19 +00:00
Clean up the code a bit. Use isInstructionTriviallyDead to be more aggressive
and more correct than use_empty(). This fixes PR635 and SimplifyCFG/2005-10-02-InvokeSimplify.ll llvm-svn: 23616
This commit is contained in:
parent
45773bd686
commit
cd43592209
@ -1284,12 +1284,16 @@ bool llvm::SimplifyCFG(BasicBlock *BB) {
|
||||
FalseValue, "retval", BI);
|
||||
else
|
||||
NewRetVal = TrueValue;
|
||||
|
||||
DEBUG(std::cerr << "\nCHANGING BRANCH TO TWO RETURNS INTO SELECT:"
|
||||
<< "\n " << *BI << "Select = " << *NewRetVal
|
||||
<< "TRUEBLOCK: " << *TrueSucc << "FALSEBLOCK: "<< *FalseSucc);
|
||||
|
||||
new ReturnInst(NewRetVal, BI);
|
||||
BI->getParent()->getInstList().erase(BI);
|
||||
if (BrCond->use_empty())
|
||||
if (Instruction *BrCondI = dyn_cast<Instruction>(BrCond))
|
||||
BrCondI->getParent()->getInstList().erase(BrCondI);
|
||||
BI->eraseFromParent();
|
||||
if (Instruction *BrCondI = dyn_cast<Instruction>(BrCond))
|
||||
if (isInstructionTriviallyDead(BrCondI))
|
||||
BrCondI->eraseFromParent();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user