[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:17:25 PST 2017


davidxl added inline comments.


================
Comment at: lib/CodeGen/MachineBlockPlacement.cpp:899
+          * MBPI->getEdgeProbability(SuccPred, Succ);
+      BestEdges[SuccIndex].push_back(std::make_tuple(EdgeFreq, SuccPred, Succ));
+    }
----------------
Using tuple does not increase readability (e.g. mapping get<0> ... to actual field). It is better to just use a struct.


================
Comment at: lib/CodeGen/MachineBlockPlacement.cpp:917
+  std::stable_sort(BestEdges[1].begin(), BestEdges[1].end(), Cmp);
+  auto BestA = BestEdges[0].begin();
+  auto BestB = BestEdges[1].begin();
----------------
To greatly increase readability, please put code between line 917 and line 934 into a helper function: getBestFallEdgesInLattice(..) with comment like:

// Find two non-conflicting edges with maximal total frequency in the lattice to be used as fall through. 


Repository:
  rL LLVM

https://reviews.llvm.org/D28522





More information about the llvm-commits mailing list