[PATCH] D34745: Revert Revert [MBP] do not rotate loop if it creates extra branch

Serguei Katkov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 28 03:01:04 PDT 2017


skatkov added a comment.

Hi Kyle,

please review the patch with a fix.

Thank you in advance!



================
Comment at: lib/CodeGen/MachineBlockPlacement.cpp:1975
+    MachineBasicBlock *NextBlockInChain = *std::next(ExitIt);
+    if (NextBlockInChain->isPredecessor(ExitingBB))
+      if (!Top->isPredecessor(Bottom))
----------------
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.


https://reviews.llvm.org/D34745





More information about the llvm-commits mailing list