forked from OSchip/llvm-project
[NFC][SimplifyCFG] Rewrite isCleanupBlockEmpty() to be iterator_range-based
This commit is contained in:
parent
c2ebb32465
commit
1f452ac1d7
|
@ -4039,10 +4039,9 @@ bool SimplifyCFGOpt::simplifyCommonResume(ResumeInst *RI) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if cleanup block is empty
|
// Check if cleanup block is empty
|
||||||
static bool isCleanupBlockEmpty(Instruction *Inst, Instruction *RI) {
|
static bool isCleanupBlockEmpty(iterator_range<BasicBlock::iterator> R) {
|
||||||
BasicBlock::iterator I = Inst->getIterator(), E = RI->getIterator();
|
for (Instruction &I : R) {
|
||||||
while (++I != E) {
|
auto *II = dyn_cast<IntrinsicInst>(&I);
|
||||||
auto *II = dyn_cast<IntrinsicInst>(I);
|
|
||||||
if (!II)
|
if (!II)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -4068,7 +4067,8 @@ bool SimplifyCFGOpt::simplifySingleResume(ResumeInst *RI) {
|
||||||
"Resume must unwind the exception that caused control to here");
|
"Resume must unwind the exception that caused control to here");
|
||||||
|
|
||||||
// Check that there are no other instructions except for debug intrinsics.
|
// Check that there are no other instructions except for debug intrinsics.
|
||||||
if (!isCleanupBlockEmpty(LPInst, RI))
|
if (!isCleanupBlockEmpty(
|
||||||
|
make_range<Instruction *>(LPInst->getNextNode(), RI)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Turn all invokes that unwind here into calls and delete the basic block.
|
// Turn all invokes that unwind here into calls and delete the basic block.
|
||||||
|
@ -4106,7 +4106,8 @@ static bool removeEmptyCleanup(CleanupReturnInst *RI) {
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Check that there are no other instructions except for benign intrinsics.
|
// Check that there are no other instructions except for benign intrinsics.
|
||||||
if (!isCleanupBlockEmpty(CPInst, RI))
|
if (!isCleanupBlockEmpty(
|
||||||
|
make_range<Instruction *>(CPInst->getNextNode(), RI)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// If the cleanup return we are simplifying unwinds to the caller, this will
|
// If the cleanup return we are simplifying unwinds to the caller, this will
|
||||||
|
|
Loading…
Reference in New Issue