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

Kyle Butt via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 8 15:40:06 PST 2017


iteratee marked 4 inline comments as done.
iteratee added inline comments.


================
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
----------------
davidxl wrote:
> The code will be cleaner if early return is done here too and let the tail merging checking follow.
Tail duplication is the early return case.


================
Comment at: lib/CodeGen/MachineBlockPlacement.cpp:962
+      // Else merge
+      BlockToChain[Succ1]->merge(Succ2, BlockToChain[Succ2]);
+    }
----------------
davidxl wrote:
> Why do you need to do chain merging here? The method is supposed to do analysis only.
Well, I'm open to suggestions, but if we don't merge the triangle edge, it doesn't get chosen. We know it's optimal right now.

Should we have a src->dest map that saves the other side of lattices and then follow it when we are trying to choose the successor for src?
That would be cleaner.


https://reviews.llvm.org/D28522





More information about the llvm-commits mailing list