mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-09 13:33:17 +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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23616 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
457029c244
commit
7a66e686fe
@ -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