[llvm] b716d0a - [LoopVectorize] Clean up VPReductionRecipe::execute. NFC
Rosie Sumpter via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 26 09:30:46 PDT 2021
Author: Rosie Sumpter
Date: 2021-10-26T17:18:25+01:00
New Revision: b716d0aa94f1c0b8779f06953171f626cd828bf0
URL: https://github.com/llvm/llvm-project/commit/b716d0aa94f1c0b8779f06953171f626cd828bf0
DIFF: https://github.com/llvm/llvm-project/commit/b716d0aa94f1c0b8779f06953171f626cd828bf0.diff
LOG: [LoopVectorize] Clean up VPReductionRecipe::execute. NFC
Use RdxDesc->getOpcode instead of getUnderlingInstr()->getOpcode.
Move the code which finds Kind and IsOrdered to be outside the for loop
since neither of these change with the vector part.
Differential Revision: https://reviews.llvm.org/D112547
Added:
Modified:
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index 3612ae28165c..c7dd99b30469 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -9747,9 +9747,9 @@ void VPInterleaveRecipe::execute(VPTransformState &State) {
void VPReductionRecipe::execute(VPTransformState &State) {
assert(!State.Instance && "Reduction being replicated.");
Value *PrevInChain = State.get(getChainOp(), 0);
+ RecurKind Kind = RdxDesc->getRecurrenceKind();
+ bool IsOrdered = State.ILV->useOrderedReductions(*RdxDesc);
for (unsigned Part = 0; Part < State.UF; ++Part) {
- RecurKind Kind = RdxDesc->getRecurrenceKind();
- bool IsOrdered = State.ILV->useOrderedReductions(*RdxDesc);
Value *NewVecOp = State.get(getVecOp(), Part);
if (VPValue *Cond = getCondOp()) {
Value *NewCond = State.get(Cond, Part);
@@ -9769,8 +9769,8 @@ void VPReductionRecipe::execute(VPTransformState &State) {
PrevInChain);
else
NewRed = State.Builder.CreateBinOp(
- (Instruction::BinaryOps)getUnderlyingInstr()->getOpcode(),
- PrevInChain, NewVecOp);
+ (Instruction::BinaryOps)RdxDesc->getOpcode(Kind), PrevInChain,
+ NewVecOp);
PrevInChain = NewRed;
} else {
PrevInChain = State.get(getChainOp(), Part);
@@ -9782,11 +9782,10 @@ void VPReductionRecipe::execute(VPTransformState &State) {
NewRed, PrevInChain);
} else if (IsOrdered)
NextInChain = NewRed;
- else {
+ else
NextInChain = State.Builder.CreateBinOp(
- (Instruction::BinaryOps)getUnderlyingInstr()->getOpcode(), NewRed,
+ (Instruction::BinaryOps)RdxDesc->getOpcode(Kind), NewRed,
PrevInChain);
- }
State.set(this, NextInChain, Part);
}
}
More information about the llvm-commits
mailing list