[PATCH] Cleanup early-exit from analyzeCall

Easwaran Raman eraman at google.com
Fri Mar 13 14:55:38 PDT 2015


Sorry about the bad testcase. I verified that inlining didn't happen before and happened after the change by printing debug messages, but never tested the test case as written. I will update it.


REPOSITORY
  rL LLVM

================
Comment at: lib/Analysis/IPA/InlineCost.cpp:1229-1240
@@ -1231,3 +1228,14 @@
 
+  if (NumVectorInstructions > NumInstructions / 2)
+    VectorBonus = FiftyPercentVectorBonus;
+  else if (NumVectorInstructions > NumInstructions / 10)
+    VectorBonus = TenPercentVectorBonus;
+  else
+    VectorBonus = 0;
+
+  // We applied the maximum possible vector bonus at the beginning. Now,
+  // subtract that from Threshold and apply the correct vector bonus before
+  // comparing against Cost.
+  Threshold -= FiftyPercentVectorBonus;
   Threshold += VectorBonus;
 
----------------
chandlerc wrote:
> How about just moving the comment up above NumVectorInstructions checks, and do two different subtracts from Threshold based on the specific instruction ratios?
If you mean something like
if (NumVectorInstructions <= NumInstructions / 10)
    Threshold -= FiftyPercentVectorBonus;
  else if (NumVectorInstructions <= NumInstructions / 2)
    Threshold -= (FiftyPercentVectorBonus - TenPercentVectorBonus);

a side effect of the above is that we won't set VectorBonus and won't print the value as part of the DEBUG_PRINT_STAT. Not a big deal, but I've found the stats useful. (Or do you want to move the Threshold += VectorBonus to where VectorBonus is set?)

http://reviews.llvm.org/D8267

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






More information about the llvm-commits mailing list