[PATCH] D114253: [LV] Check VPValue operand instead of Cost::isUniformAfterVec (NFC).
Florian Hahn via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 19 08:52:03 PST 2021
fhahn created this revision.
fhahn added reviewers: reames, Ayal, gilr, rengolin.
Herald added subscribers: rogfer01, bollu, hiraditya.
fhahn requested review of this revision.
Herald added a subscriber: vkmr.
Herald added a project: LLVM.
ILV::scalarizeInstruction still uses the original IR operands to check
if an input value is uniform after vectorization.
There is no need to go back to the cost model to figure that out, as the
information is already explicit in the VPlan. Just check directly
whether the VPValue is defined outside the plan or is a uniform
VPReplicateRecipe.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D114253
Files:
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
Index: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
===================================================================
--- llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -3068,14 +3068,13 @@
Builder.GetInsertPoint());
// Replace the operands of the cloned instructions with their scalar
// equivalents in the new loop.
- for (unsigned op = 0, e = User.getNumOperands(); op != e; ++op) {
- auto *Operand = dyn_cast<Instruction>(Instr->getOperand(op));
+ for (auto &I : enumerate(User.operands())) {
auto InputInstance = Instance;
- if (!Operand || !OrigLoop->contains(Operand) ||
- (Cost->isUniformAfterVectorization(Operand, State.VF)))
+ VPValue *Op = I.value();
+ auto RepR = dyn_cast_or_null<VPReplicateRecipe>(Op->getDef());
+ if (!Op->getDef() || (RepR && RepR->isUniform()))
InputInstance.Lane = VPLane::getFirstLane();
- auto *NewOp = State.get(User.getOperand(op), InputInstance);
- Cloned->setOperand(op, NewOp);
+ Cloned->setOperand(I.index(), State.get(Op, InputInstance));
}
addNewMetadata(Cloned, Instr);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D114253.388518.patch
Type: text/x-patch
Size: 1169 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211119/a7b001ce/attachment.bin>
More information about the llvm-commits
mailing list