[PATCH] D22364: [MBP] Comments cleanup /NFC

David Li via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 14 23:01:13 PDT 2016


davidxl added inline comments.

================
Comment at: lib/CodeGen/MachineBlockPlacement.cpp:617
@@ +616,3 @@
+  //   cost:                                  cost:
+  //   freq(S->Pred) + Pred(S->BB)            2 * freq (S->Pred)
+  //                   ^^^^
----------------
yes, it should be freq(BB->Succ) which is the same as freq(S->BB)

================
Comment at: lib/CodeGen/MachineBlockPlacement.cpp:621
@@ +620,3 @@
+  //
+  // When we know from profile data that the branch condition in block S is
+  // true, and thus that path S->BB->Succ is taken, then it is of course better
----------------
This paragraph can be changed to:

if we have profile data (i.e, branch probabilities can be trusted), the cost (number of taken branches) with layout S->BB->Succ->Pred is  2 * freq(S->Pred) while the cost of topo order is freq(S->Pred) + freq(S->BB).  We know Prob(S->BB) > Prob(S->Pred),  so freq(S->BB) >  freq(S->Pred), which means the cost of topological order is greater ...


https://reviews.llvm.org/D22364





More information about the llvm-commits mailing list