[PATCH] D22521: [MBP] do not reorder and move up loop latch block

David Li via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 29 11:17:44 PDT 2016


davidxl added a comment.

Can you add a test case to cover that rotation happens when there is no fall through predecessor for the header?


================
Comment at: lib/CodeGen/MachineBlockPlacement.cpp:937
@@ -936,1 +936,3 @@
 
+static MachineBasicBlock * findLayoutPredecessor(MachineBasicBlock &MB)
+{
----------------
This should be renamed to findFallthroughPredecessor  and add a brief documentation.

LayoutPredecessor by definition does not need to be its cfg predecessor.

================
Comment at: lib/CodeGen/MachineBlockPlacement.cpp:975
@@ +974,3 @@
+    MachineBasicBlock *TBB = nullptr, *FBB = nullptr;
+    if (!TII->analyzeBranch(*LayoutPredBB, TBB, FBB, Cond) ||    // fallthrough
+        (TBB == L.getHeader() && !FBB)) {              // branch to loop header
----------------
if (...->canFallthrough()) {
 ..
}


https://reviews.llvm.org/D22521





More information about the llvm-commits mailing list