[PATCH] [MachineLICM] Sink instructions only if they are unlikely to be executed

Quentin Colombet qcolombet at apple.com
Thu Mar 19 15:30:25 PDT 2015


================
Comment at: lib/CodeGen/MachineLICM.cpp:836
@@ +835,3 @@
+    // factor of the a cost model.
+    if (HeaderFreq * ColdProb < MBFI->getBlockFreq(B))
+      continue;
----------------
djasper wrote:
> qcolombet wrote:
> > Shouldn’t we have a threshold in the other direction as well, i.e., Freq(B) < Freq(Preheader) * <some threshold>?
> Could you elaborate what that might accomplish?
> 
> Also the frequency of the *pre*header doesn't really relate strongly to the frequencies within the loop AFAICT.
Sure, but the instructions we are moving come from the pre header and we do not want them to explode the number of time they are executed.
Let say the pre-header is executed once and the loop 1,000,000 times. Then, even in the cold path of the loop, this is still rather expensive to sink the instructions.

http://reviews.llvm.org/D8451

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list