[llvm] b7e7f4e - [InlineCost] Improve debugging experience by adding print about initial inlining cost

Dawid Jurczak via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 24 07:29:34 PDT 2022


Author: Dawid Jurczak
Date: 2022-06-24T16:27:26+02:00
New Revision: b7e7f4e1b6f9567562d4296b5b2a47a678ff8e8e

URL: https://github.com/llvm/llvm-project/commit/b7e7f4e1b6f9567562d4296b5b2a47a678ff8e8e
DIFF: https://github.com/llvm/llvm-project/commit/b7e7f4e1b6f9567562d4296b5b2a47a678ff8e8e.diff

LOG: [InlineCost] Improve debugging experience by adding print about initial inlining cost

Differential Revision: https://reviews.llvm.org/D127597

Added: 
    

Modified: 
    llvm/lib/Analysis/InlineCost.cpp
    llvm/test/Transforms/Inline/X86/extractvalue.ll
    llvm/test/Transforms/Inline/X86/insertvalue.ll

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Analysis/InlineCost.cpp b/llvm/lib/Analysis/InlineCost.cpp
index b83f5cf40cddb..63fe651bb5718 100644
--- a/llvm/lib/Analysis/InlineCost.cpp
+++ b/llvm/lib/Analysis/InlineCost.cpp
@@ -982,6 +982,8 @@ class InlineCostCallAnalyzer final : public CallAnalyzer {
     if (F.getCallingConv() == CallingConv::Cold)
       Cost += InlineConstants::ColdccPenalty;
 
+    LLVM_DEBUG(dbgs() << "      Initial cost: " << Cost << "\n");
+
     // Check if we're done. This can happen due to bonuses and penalties.
     if (Cost >= Threshold && !ComputeFullInlineCost)
       return InlineResult::failure("high cost");

diff  --git a/llvm/test/Transforms/Inline/X86/extractvalue.ll b/llvm/test/Transforms/Inline/X86/extractvalue.ll
index ad86def50e38a..8661c532246a6 100644
--- a/llvm/test/Transforms/Inline/X86/extractvalue.ll
+++ b/llvm/test/Transforms/Inline/X86/extractvalue.ll
@@ -8,6 +8,7 @@ target triple = "x86_64-unknown-unknown"
 ; Check that extractvalue's are free.
 
 ; CHECK: Analyzing call of callee... (caller:caller_range)
+; CHECK-NEXT: Initial cost: -35
 ; CHECK-NEXT: define i32 @callee({ i32, i32 } %arg) {
 ; CHECK-NEXT: ; cost before = -35, cost after = -35, threshold before = 0, threshold after = 0, cost delta = 0
 ; CHECK-NEXT:   %r = extractvalue { i32, i32 } %arg, 0

diff  --git a/llvm/test/Transforms/Inline/X86/insertvalue.ll b/llvm/test/Transforms/Inline/X86/insertvalue.ll
index 20111df73b33b..ce08c9bda36c0 100644
--- a/llvm/test/Transforms/Inline/X86/insertvalue.ll
+++ b/llvm/test/Transforms/Inline/X86/insertvalue.ll
@@ -8,6 +8,7 @@ target triple = "x86_64-unknown-unknown"
 ; Check that insertvalue's aren't free.
 
 ; CHECK: Analyzing call of callee... (caller:caller_range)
+; CHECK-NEXT: Initial cost: -40
 ; CHECK-NEXT: define { i32, i32 } @callee({ i32, i32 } %arg, i32 %arg1) {
 ; CHECK-NEXT: ; cost before = -40, cost after = -35, threshold before = 0, threshold after = 0, cost delta = 5
 ; CHECK-NEXT:   %r = insertvalue { i32, i32 } %arg, i32 %arg1, 0


        


More information about the llvm-commits mailing list