[llvm] 3dcec5e - [LV] Consistently use vputils::isUniformAfterVectorization [mostly nfc]

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 26 11:09:29 PDT 2022


Author: Philip Reames
Date: 2022-08-26T11:09:17-07:00
New Revision: 3dcec5e29ff73d9f42b364885119105b69c2bb37

URL: https://github.com/llvm/llvm-project/commit/3dcec5e29ff73d9f42b364885119105b69c2bb37
DIFF: https://github.com/llvm/llvm-project/commit/3dcec5e29ff73d9f42b364885119105b69c2bb37.diff

LOG: [LV] Consistently use vputils::isUniformAfterVectorization [mostly nfc]

I'd extracted isUniform, and Florian moved isUniformAfterVectorization out of VPlan at basically the same time. Let's go ahead and merge them.

For the VPTransformState::get path, a VPValue without a def (which corresponds to an external IR value outside of VPLan) is explicitly handled above the uniform check.  On the scalarizeInstruction path, I'm less sure why the change isn't visible, but test cases which would seem likely to hit it were already being handled as uniform through some other mechanism.  It would be correct to consider values defined outside of vplan uniform here.

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 68fab0f3d712..b62e41ae7144 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -2721,14 +2721,6 @@ void InnerLoopVectorizer::vectorizeInterleaveGroup(
   }
 }
 
-/// Return true if this VPValue represents a computation which is
-/// uniform-per-part.
-static bool isUniform(VPValue *VPV) {
-  if (VPReplicateRecipe *OperandR = dyn_cast<VPReplicateRecipe>(VPV))
-    return OperandR->isUniform();
-  return false;
-}
-
 void InnerLoopVectorizer::scalarizeInstruction(Instruction *Instr,
                                                VPReplicateRecipe *RepRecipe,
                                                const VPIteration &Instance,
@@ -2766,7 +2758,7 @@ void InnerLoopVectorizer::scalarizeInstruction(Instruction *Instr,
   for (const auto &I : enumerate(RepRecipe->operands())) {
     auto InputInstance = Instance;
     VPValue *Operand = I.value();
-    if (isUniform(Operand))
+    if (vputils::isUniformAfterVectorization(Operand))
       InputInstance.Lane = VPLane::getFirstLane();
     Cloned->setOperand(I.index(), State.get(Operand, InputInstance));
   }
@@ -9875,7 +9867,7 @@ Value *VPTransformState::get(VPValue *Def, unsigned Part) {
     return ScalarValue;
   }
 
-  bool IsUniform = isUniform(Def);
+  bool IsUniform = vputils::isUniformAfterVectorization(Def);
 
   unsigned LastLane = IsUniform ? 0 : VF.getKnownMinValue() - 1;
   // Check if there is a scalar value for the selected lane.


        


More information about the llvm-commits mailing list