[llvm] ba5b015 - [InlineCost] CallAnalyzer: use TTI info for extractvalue - they are free (PR50099)
Roman Lebedev via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 30 03:55:27 PDT 2021
Author: Roman Lebedev
Date: 2021-04-30T13:55:11+03:00
New Revision: ba5b015b0de13b412d73d127ca181115c5e78717
URL: https://github.com/llvm/llvm-project/commit/ba5b015b0de13b412d73d127ca181115c5e78717
DIFF: https://github.com/llvm/llvm-project/commit/ba5b015b0de13b412d73d127ca181115c5e78717.diff
LOG: [InlineCost] CallAnalyzer: use TTI info for extractvalue - they are free (PR50099)
It seems incorrect to use TTI data in some places,
and override it in others. In this case, TTI says
that `extractvalue` are free, yet we bill them.
While this doesn't address https://bugs.llvm.org/show_bug.cgi?id=50099 yet,
it reduces the cost from 55 to 50 while the threshold is 45.
Differential Revision: https://reviews.llvm.org/D101228
Added:
Modified:
llvm/lib/Analysis/InlineCost.cpp
llvm/test/Transforms/Inline/X86/extractvalue.ll
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/InlineCost.cpp b/llvm/lib/Analysis/InlineCost.cpp
index 9105813fad85d..91ac849f97b12 100644
--- a/llvm/lib/Analysis/InlineCost.cpp
+++ b/llvm/lib/Analysis/InlineCost.cpp
@@ -1759,8 +1759,8 @@ bool CallAnalyzer::visitExtractValue(ExtractValueInst &I) {
}))
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 @@ bool CallAnalyzer::visitInsertValue(InsertValueInst &I) {
}))
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.
diff --git a/llvm/test/Transforms/Inline/X86/extractvalue.ll b/llvm/test/Transforms/Inline/X86/extractvalue.ll
index 1d1603a49a165..ad86def50e38a 100644
--- a/llvm/test/Transforms/Inline/X86/extractvalue.ll
+++ b/llvm/test/Transforms/Inline/X86/extractvalue.ll
@@ -9,9 +9,9 @@ target triple = "x86_64-unknown-unknown"
; 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: }
More information about the llvm-commits
mailing list