[PATCH] D28522: Codegen: Make chains from lattice-shaped CFGs

David Li via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 8 12:24:13 PST 2017


davidxl added inline comments.


================
Comment at: lib/CodeGen/MachineBlockPlacement.cpp:936
+
+  if (std::get<1>(*BestA) == BB) {
+    // Did we pick the triangle edge? If tail-duplication is profitable, do
----------------
Do early return if condition is not true to reduce nesting level.


================
Comment at: lib/CodeGen/MachineBlockPlacement.cpp:940
+    // optimal.
+    if (std::get<2>(*BestA) == std::get<1>(*BestB)) {
+      // The edges are BB->Succ1->Succ2, and we're looking to see if BB->Succ2
----------------
The code will be cleaner if early return is done here too and let the tail merging checking follow.


================
Comment at: lib/CodeGen/MachineBlockPlacement.cpp:962
+      // Else merge
+      BlockToChain[Succ1]->merge(Succ2, BlockToChain[Succ2]);
+    }
----------------
Why do you need to do chain merging here? The method is supposed to do analysis only.


Repository:
  rL LLVM

https://reviews.llvm.org/D28522





More information about the llvm-commits mailing list