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

Dawid Jurczak via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 12 05:14:15 PDT 2022


yurai007 created this revision.
yurai007 added reviewers: nikic, xbolva00, mtrofin, durin42, kyulee, DaniilSuchkov, lebedev.ri.
Herald added subscribers: ChuanqiXu, haicheng, hiraditya.
Herald added a project: All.
yurai007 requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D127597

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


Index: llvm/test/Transforms/Inline/X86/insertvalue.ll
===================================================================
--- llvm/test/Transforms/Inline/X86/insertvalue.ll
+++ llvm/test/Transforms/Inline/X86/insertvalue.ll
@@ -8,6 +8,7 @@
 ; 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
Index: llvm/test/Transforms/Inline/X86/extractvalue.ll
===================================================================
--- llvm/test/Transforms/Inline/X86/extractvalue.ll
+++ llvm/test/Transforms/Inline/X86/extractvalue.ll
@@ -8,6 +8,7 @@
 ; 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
Index: llvm/lib/Analysis/InlineCost.cpp
===================================================================
--- llvm/lib/Analysis/InlineCost.cpp
+++ llvm/lib/Analysis/InlineCost.cpp
@@ -978,6 +978,8 @@
     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");


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D127597.436211.patch
Type: text/x-patch
Size: 1778 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220612/4e3c6c87/attachment.bin>


More information about the llvm-commits mailing list