[PATCH] Cleanup early-exit from analyzeCall

Chandler Carruth chandlerc at gmail.com
Fri Mar 13 14:05:20 PDT 2015


(sorry for delays)


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;
 
----------------
How about just moving the comment up above NumVectorInstructions checks, and do two different subtracts from Threshold based on the specific instruction ratios?

================
Comment at: lib/Analysis/IPA/InlineCost.cpp:1242
@@ -1233,3 +1241,3 @@
 
   return Cost < Threshold;
 }
----------------
Where do you subtract off the single-bb bonus?

================
Comment at: test/Transforms/Inline/vector-bonus.ll:1
@@ +1,2 @@
+; RUN: opt < %s -inline -inline-threshold=40 -disable-output
+
----------------
Did you try running this test without your change? I think you will find that it doesn't fail -- you don't pipe the output of opt to the FileCheck tool, and so we never check anything.

I would suggest "testing your test" by ensuring your test fails with the old version of opt first.

================
Comment at: test/Transforms/Inline/vector-bonus.ll:35-37
@@ +34,4 @@
+
+; CHECK: @bar()
+; CHECK-NOT: call i32 @bar
+; CHECK: ret
----------------
I would use CHECK-LABEL and put the checks inside the function body of @bar so its clear that there are checks associated with that function.

http://reviews.llvm.org/D8267

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






More information about the llvm-commits mailing list