[PATCH] D26848: [PATCH] Reduce inline thresholds to compensate for cost changes

James Molloy via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 21 01:25:43 PST 2016


jmolloy updated this revision to Diff 78692.

Repository:
  rL LLVM

https://reviews.llvm.org/D26848

Files:
  include/llvm/Analysis/InlineCost.h
  test/Transforms/Inline/ephemeral.ll
  test/Transforms/Inline/inline-fp.ll


Index: test/Transforms/Inline/inline-fp.ll
===================================================================
--- test/Transforms/Inline/inline-fp.ll
+++ test/Transforms/Inline/inline-fp.ll
@@ -132,5 +132,5 @@
 
 declare float @llvm.pow.f32(float, float) optsize minsize
 
-attributes #0 = { minsize optsize }
-attributes #1 = { minsize optsize "use-soft-float"="true" }
+attributes #0 = { optsize }
+attributes #1 = { optsize "use-soft-float"="true" }
Index: test/Transforms/Inline/ephemeral.ll
===================================================================
--- test/Transforms/Inline/ephemeral.ll
+++ test/Transforms/Inline/ephemeral.ll
@@ -2,30 +2,28 @@
 
 @a = global i32 4
 
-define i1 @inner() {
+define i32 @inner() {
   %a1 = load volatile i32, i32* @a
-  %x1 = add i32 %a1, %a1
-  %c = icmp eq i32 %x1, 0
 
   ; Here are enough instructions to prevent inlining, but because they are used
   ; only by the @llvm.assume intrinsic, they're free (and, thus, inlining will
   ; still happen).
   %a2 = mul i32 %a1, %a1
   %a3 = sub i32 %a1, 5
   %a4 = udiv i32 %a3, -13
   %a5 = mul i32 %a4, %a4
-  %a6 = add i32 %a5, %x1
+  %a6 = add i32 %a5, %a5
   %ca = icmp sgt i32 %a6, -7
   tail call void @llvm.assume(i1 %ca)
 
-  ret i1 %c
+  ret i32 %a1
 }
 
 ; @inner() should be inlined for -Oz.
 ; CHECK-NOT: call i1 @inner
-define i1 @outer() optsize {
-   %r = call i1 @inner()
-   ret i1 %r
+define i32 @outer() optsize {
+   %r = call i32 @inner()
+   ret i32 %r
 }
 
 declare void @llvm.assume(i1) nounwind
Index: include/llvm/Analysis/InlineCost.h
===================================================================
--- include/llvm/Analysis/InlineCost.h
+++ include/llvm/Analysis/InlineCost.h
@@ -30,13 +30,13 @@
 namespace InlineConstants {
 // Various thresholds used by inline cost analysis.
 /// Use when optsize (-Os) is specified.
-const int OptSizeThreshold = 75;
+const int OptSizeThreshold = 50;
 
 /// Use when minsize (-Oz) is specified.
-const int OptMinSizeThreshold = 25;
+const int OptMinSizeThreshold = 5;
 
 /// Use when -O3 is specified.
-const int OptAggressiveThreshold = 275;
+const int OptAggressiveThreshold = 250;
 
 // Various magic constants used to adjust heuristics.
 const int InstrCost = 5;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26848.78692.patch
Type: text/x-patch
Size: 2234 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161121/69257886/attachment.bin>


More information about the llvm-commits mailing list