Skip to content

Commit f79f577

Browse files
committed
Address comments and update test
1 parent 2e18209 commit f79f577

File tree

3 files changed

+1560
-572
lines changed

3 files changed

+1560
-572
lines changed

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8848,6 +8848,9 @@ VPRecipeBuilder::getScaledReduction(Instruction *PHI, Instruction *RdxExitInstr,
88488848

88498849
SmallVector<std::pair<PartialReductionChain, unsigned>> Chains;
88508850

8851+
// Try and get a scaled reduction from the first non-phi operand.
8852+
// If one is found, we use the discovered reduction instruction in
8853+
// place of the accumulator for costing.
88518854
if (auto *OpInst = dyn_cast<Instruction>(Op)) {
88528855
if (auto SR0 = getScaledReduction(PHI, OpInst, Range)) {
88538856
Chains.append(*SR0);
@@ -8875,10 +8878,6 @@ VPRecipeBuilder::getScaledReduction(Instruction *PHI, Instruction *RdxExitInstr,
88758878
Instruction *ExtA = cast<Instruction>(BinOp->getOperand(0));
88768879
Instruction *ExtB = cast<Instruction>(BinOp->getOperand(1));
88778880

8878-
// Check that the extends extend from the same type.
8879-
if (A->getType() != B->getType())
8880-
return std::nullopt;
8881-
88828881
TTI::PartialReductionExtendKind OpAExtend =
88838882
TargetTransformInfo::getPartialReductionExtendKind(ExtA);
88848883
TTI::PartialReductionExtendKind OpBExtend =

0 commit comments

Comments
 (0)