}
bool SimplifyCFGOpt::SimplifyCleanupReturn(CleanupReturnInst *RI) {
+ // It is possible to transiantly have an undef cleanuppad operand because we
+ // have deleted some, but not all, dead blocks.
+ // Eventually, this block will be deleted.
+ if (isa<UndefValue>(RI->getOperand(0)))
+ return false;
+
if (removeEmptyCleanup(RI))
return true;
if ((pred_empty(BB) &&
BB != &BB->getParent()->getEntryBlock()) ||
BB->getSinglePredecessor() == BB) {
- // Get the block mostly empty.
- Changed |= removeAllNonTerminatorAndEHPadInstructions(BB) > 0;
- // Now, verify that we succeeded getting the block empty.
- // This will not be the case if this unreachable BB creates a token which is
- // consumed by other unreachable blocks.
- Instruction *FirstNonPHI = BB->getFirstNonPHI();
- if (isa<TerminatorInst>(FirstNonPHI) && FirstNonPHI->use_empty()) {
- DEBUG(dbgs() << "Removing BB: \n" << *BB);
- DeleteDeadBlock(BB);
- return true;
- }
+ DEBUG(dbgs() << "Removing BB: \n" << *BB);
+ DeleteDeadBlock(BB);
+ return true;
}
// Check to see if we can constant propagate this terminator instruction