[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
Fri Apr 30 03:55:42 PDT 2021


This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was automatically updated to reflect the committed changes.
lebedev.ri marked an inline comment as done.
Closed by commit rGba5b015b0de1: [InlineCost] CallAnalyzer: use TTI info for extractvalue - they are freeā€¦ (authored by lebedev.ri).

Changed prior to commit:
  https://reviews.llvm.org/D101228?vs=341174&id=341834#toc

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
@@ -1759,8 +1759,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 Base::visitExtractValue(I);
 }
 
 bool CallAnalyzer::visitInsertValue(InsertValueInst &I) {
@@ -1772,8 +1772,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 Base::visitInsertValue(I);
 }
 
 /// Try to simplify a call site.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D101228.341834.patch
Type: text/x-patch
Size: 1641 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210430/4e6ed545/attachment.bin>


More information about the llvm-commits mailing list