[PATCH] D34745: Revert Revert [MBP] do not rotate loop if it creates extra branch
Kyle Butt via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 10 11:35:13 PDT 2017
iteratee accepted this revision.
iteratee added a comment.
This revision is now accepted and ready to land.
Looks fine. I would prefer the fallthrough checks be successor checks, but I can accept it either way.
================
Comment at: lib/CodeGen/MachineBlockPlacement.cpp:1975
+ MachineBasicBlock *NextBlockInChain = *std::next(ExitIt);
+ if (NextBlockInChain->isPredecessor(ExitingBB))
+ if (!Top->isPredecessor(Bottom))
----------------
skatkov wrote:
> The crash was on this line due to in some conditions ExitingBB may be the last BB in a chain.
> The added regression test shows this condition. Specifically it is possible that ExitingBB has a fallthrough but it is not viable. For example, if exit block is a member of another loop which has been rotated and it results that there is no fallthrough from ExitingBB to loop header of another loop.
Can you reverse this test? ExitingBB->isSuccessor(NextBlockInChain)
================
Comment at: lib/CodeGen/MachineBlockPlacement.cpp:1976
+ if (NextBlockInChain->isPredecessor(ExitingBB))
+ if (!Top->isPredecessor(Bottom))
+ return;
----------------
Same here.
https://reviews.llvm.org/D34745
More information about the llvm-commits
mailing list