[PATCH] D101228: [InlineCost] CallAnalyzer: use TTI info for extractvalue - they are free (PR50099)

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 28 06:26:33 PDT 2021


lebedev.ri updated this revision to Diff 341174.
lebedev.ri marked an inline comment as done.
lebedev.ri added a comment.

@aeubanks thank you for taking a look!
Addressing inline comments.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D101228/new/

https://reviews.llvm.org/D101228

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


Index: llvm/test/Transforms/Inline/X86/extractvalue.ll
===================================================================
--- llvm/test/Transforms/Inline/X86/extractvalue.ll
+++ llvm/test/Transforms/Inline/X86/extractvalue.ll
@@ -9,9 +9,9 @@
 
 ; CHECK: Analyzing call of callee... (caller:caller_range)
 ; CHECK-NEXT: define i32 @callee({ i32, i32 } %arg) {
-; CHECK-NEXT: ; cost before = -35, cost after = -30, threshold before = 0, threshold after = 0, cost delta = 5
+; 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
-; CHECK-NEXT: ; cost before = -30, cost after = -30, threshold before = 0, threshold after = 0, cost delta = 0
+; CHECK-NEXT: ; cost before = -35, cost after = -35, threshold before = 0, threshold after = 0, cost delta = 0
 ; CHECK-NEXT:   ret i32 %r
 ; CHECK-NEXT: }
 
Index: llvm/lib/Analysis/InlineCost.cpp
===================================================================
--- llvm/lib/Analysis/InlineCost.cpp
+++ llvm/lib/Analysis/InlineCost.cpp
@@ -1775,8 +1775,8 @@
       }))
     return true;
 
-  // SROA can look through these but give them a cost.
-  return false;
+  // SROA can't look through these, but they may be free.
+  return visitInstruction(I);
 }
 
 bool CallAnalyzer::visitInsertValue(InsertValueInst &I) {
@@ -1788,8 +1788,8 @@
       }))
     return true;
 
-  // SROA can look through these but give them a cost.
-  return false;
+  // SROA can't look through these, but they may be free.
+  return visitInstruction(I);
 }
 
 /// Try to simplify a call site.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D101228.341174.patch
Type: text/x-patch
Size: 1628 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210428/71452c50/attachment.bin>


More information about the llvm-commits mailing list