[llvm] 01ea93d - [CostModel] remove cost-kind predicate for memcpy cost
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 21 06:10:45 PDT 2020
Author: Sanjay Patel
Date: 2020-10-21T08:50:44-04:00
New Revision: 01ea93d85d6e2240d70daf52e84772aba310bc19
URL: https://github.com/llvm/llvm-project/commit/01ea93d85d6e2240d70daf52e84772aba310bc19
DIFF: https://github.com/llvm/llvm-project/commit/01ea93d85d6e2240d70daf52e84772aba310bc19.diff
LOG: [CostModel] remove cost-kind predicate for memcpy cost
The default implementation base returns TCC_Expensive (currently
set to '4'), so that explains the test diff. This probably does
not make sense for most callers, but at least now the costs will
be consistently wrong instead of mysteriously wrong.
The ARM target has an override that tries to model codegen expansion,
and that should likely be adapted for general usage.
This probably does not affect anything because the vectorizers are
the primary users of the throughput cost, but memcpy is not listed
as a trivially vectorizable intrinsic.
Added:
Modified:
llvm/include/llvm/CodeGen/BasicTTIImpl.h
llvm/test/Analysis/CostModel/X86/intrinsic-cost-kinds.ll
Removed:
################################################################################
diff --git a/llvm/include/llvm/CodeGen/BasicTTIImpl.h b/llvm/include/llvm/CodeGen/BasicTTIImpl.h
index abcd612c7b55..2eec38bbcc5d 100644
--- a/llvm/include/llvm/CodeGen/BasicTTIImpl.h
+++ b/llvm/include/llvm/CodeGen/BasicTTIImpl.h
@@ -1166,10 +1166,7 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
break;
case Intrinsic::memcpy:
- // FIXME: all cost kinds should default to the same thing?
- if (CostKind != TTI::TCK_RecipThroughput)
- return thisT()->getMemcpyCost(ICA.getInst());
- return BaseT::getIntrinsicInstrCost(ICA, CostKind);
+ return thisT()->getMemcpyCost(ICA.getInst());
case Intrinsic::masked_scatter: {
// FIXME: all cost kinds should default to the same thing?
diff --git a/llvm/test/Analysis/CostModel/X86/intrinsic-cost-kinds.ll b/llvm/test/Analysis/CostModel/X86/intrinsic-cost-kinds.ll
index c76585a51ef3..d3bf703513eb 100644
--- a/llvm/test/Analysis/CostModel/X86/intrinsic-cost-kinds.ll
+++ b/llvm/test/Analysis/CostModel/X86/intrinsic-cost-kinds.ll
@@ -226,7 +226,7 @@ define void @reduce_fmax(<16 x float> %va) {
define void @memcpy(i8* %a, i8* %b, i32 %c) {
; THRU-LABEL: 'memcpy'
-; THRU-NEXT: Cost Model: Found an estimated cost of 1 for instruction: call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %a, i8* align 1 %b, i32 32, i1 false)
+; THRU-NEXT: Cost Model: Found an estimated cost of 4 for instruction: call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %a, i8* align 1 %b, i32 32, i1 false)
; THRU-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
;
; LATE-LABEL: 'memcpy'
More information about the llvm-commits
mailing list