[PATCH] D28583: CodeGen: Allow small copyable blocks to "break" the CFG.

David Li via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 23 20:16:13 PST 2017


davidxl added a comment.

This version looks almost fine except for one remaining unaddressed comment.



================
Comment at: lib/CodeGen/MachineBlockPlacement.cpp:671
+  BranchProbability PProb = MBPI->getEdgeProbability(BB, Succ);
+  BlockFrequency P = BBFreq * PProb;
+  // At this point, we don't know which block would be chosen instead of Succ.
----------------
davidxl wrote:
> Add a short cut here with comments:
> 
> // If P is not larger, the best successor selection loop will eventually select C, not Succ (as it is not profitable to do so).
> if (P <= Qout)
>    return false;
How about this comment?  Early return can 1) speed up the computation and 2) make the following code easier to understand.




https://reviews.llvm.org/D28583





More information about the llvm-commits mailing list