[PATCH] D114253: [LV] Check VPValue operand instead of Cost::isUniformAfterVec (NFC).

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 22 07:14:35 PST 2021


fhahn updated this revision to Diff 388911.
fhahn added a comment.

rebased after4348cd42c385


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D114253/new/

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
@@ -3167,14 +3167,13 @@
                                Builder.GetInsertPoint());
   // Replace the operands of the cloned instructions with their scalar
   // equivalents in the new loop.
-  for (unsigned op = 0, e = RepRecipe->getNumOperands(); op != e; ++op) {
-    auto *Operand = dyn_cast<Instruction>(Instr->getOperand(op));
+  for (auto &I : enumerate(RepRecipe->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(RepRecipe->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.388911.patch
Type: text/x-patch
Size: 1187 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211122/e883b9ca/attachment.bin>


More information about the llvm-commits mailing list