[llvm-branch-commits] [llvm] 5a1d31a - [SLP] use reduction kind's opcode for cost model queries; NFC
Sanjay Patel via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Tue Jan 5 12:32:11 PST 2021
Author: Sanjay Patel
Date: 2021-01-05T15:12:40-05:00
New Revision: 5a1d31a28490e85de440b55e2e257b61d32e85b9
URL: https://github.com/llvm/llvm-project/commit/5a1d31a28490e85de440b55e2e257b61d32e85b9
DIFF: https://github.com/llvm/llvm-project/commit/5a1d31a28490e85de440b55e2e257b61d32e85b9.diff
LOG: [SLP] use reduction kind's opcode for cost model queries; NFC
This should be no-functional-change because the reduction kind
opcodes are 1-for-1 mappings to the instructions we are matching
as reductions. But we want to remove the need for the
`OperationData` opcode field because that does not work when
we start matching intrinsics (eg, maxnum) as reduction candidates.
Added:
Modified:
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
index 390b71e7a46b..48f2a2d2886f 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -7138,6 +7138,7 @@ class HorizontalReduction {
auto *VecTy = FixedVectorType::get(ScalarTy, ReduxWidth);
RecurKind Kind = RdxTreeInst.getKind();
+ unsigned RdxOpcode = RecurrenceDescriptor::getOpcode(Kind);
int SplittingRdxCost;
switch (Kind) {
case RecurKind::Add:
@@ -7147,9 +7148,8 @@ class HorizontalReduction {
case RecurKind::Xor:
case RecurKind::FAdd:
case RecurKind::FMul:
- SplittingRdxCost =
- TTI->getArithmeticReductionCost(RdxTreeInst.getOpcode(), VecTy,
- /*IsPairwiseForm=*/false);
+ SplittingRdxCost = TTI->getArithmeticReductionCost(
+ RdxOpcode, VecTy, /*IsPairwiseForm=*/false);
break;
case RecurKind::SMax:
case RecurKind::SMin:
@@ -7175,15 +7175,14 @@ class HorizontalReduction {
case RecurKind::Xor:
case RecurKind::FAdd:
case RecurKind::FMul:
- ScalarReduxCost =
- TTI->getArithmeticInstrCost(RdxTreeInst.getOpcode(), ScalarTy);
+ ScalarReduxCost = TTI->getArithmeticInstrCost(RdxOpcode, ScalarTy);
break;
case RecurKind::SMax:
case RecurKind::SMin:
case RecurKind::UMax:
case RecurKind::UMin:
ScalarReduxCost =
- TTI->getCmpSelInstrCost(RdxTreeInst.getOpcode(), ScalarTy) +
+ TTI->getCmpSelInstrCost(RdxOpcode, ScalarTy) +
TTI->getCmpSelInstrCost(Instruction::Select, ScalarTy,
CmpInst::makeCmpResultType(ScalarTy));
break;
More information about the llvm-branch-commits
mailing list