diff --git a/llvm/lib/Analysis/InlineCost.cpp b/llvm/lib/Analysis/InlineCost.cpp --- a/llvm/lib/Analysis/InlineCost.cpp +++ b/llvm/lib/Analysis/InlineCost.cpp @@ -68,7 +68,7 @@ static cl::opt ColdCallSiteThreshold("inline-cold-callsite-threshold", cl::Hidden, - cl::init(45), cl::ZeroOrMore, + cl::init(55), cl::ZeroOrMore, cl::desc("Threshold for inlining cold callsites")); static cl::opt InlineEnableCostBenefitAnalysis( @@ -89,7 +89,7 @@ // PGO before we actually hook up inliner with analysis passes such as BPI and // BFI. static cl::opt ColdThreshold( - "inlinecold-threshold", cl::Hidden, cl::init(45), cl::ZeroOrMore, + "inlinecold-threshold", cl::Hidden, cl::init(55), cl::ZeroOrMore, cl::desc("Threshold for inlining functions with cold attribute")); static cl::opt diff --git a/llvm/test/Transforms/Inline/X86/inline-cold-callsite.ll b/llvm/test/Transforms/Inline/X86/inline-cold-callsite.ll new file mode 100644 --- /dev/null +++ b/llvm/test/Transforms/Inline/X86/inline-cold-callsite.ll @@ -0,0 +1,37 @@ +; RUN: opt < %s -inline -debug-only=inline-cost -print-instruction-comments -S -mtriple=x86_64-unknown-linux-gnu 2>&1 | FileCheck %s +; RUN: opt < %s -passes='cgscc(inline)' -debug-only=inline-cost -print-instruction-comments -S -mtriple=x86_64-unknown-linux-gnu 2>&1 | FileCheck %s + +; REQUIRES: asserts + +; Check the threshold for inlining cold callsites. + +; CHECK: Analyzing call of cold_callee... (caller:caller) +; CHECK-NEXT: Cold callsite +; CHECK-NEXT: define void @cold_callee() { +; CHECK-NEXT: ; cost before = -30, cost after = -30, threshold before = 51, threshold after = 51, cost delta = 0 +; CHECK-NEXT: ret void +; CHECK-NEXT: } + +declare void @hot_callee() + +define void @cold_callee() { + ret void +} + +define void @caller(i1 %c) { +entry: + br i1 %c, label %hot, label %cold, !prof !0 + +hot: + call void @hot_callee() + br label %end + +cold: + call void @cold_callee() + br label %end + +end: + ret void +} + +!0 = !{!"branch_weights", i32 1000000, i32 1}