[VPlan] Move isUniformAfterVectorization from VPlan to vputils (NFC).
authorFlorian Hahn <flo@fhahn.com>
Fri, 26 Aug 2022 17:26:32 +0000 (18:26 +0100)
committerFlorian Hahn <flo@fhahn.com>
Fri, 26 Aug 2022 17:26:33 +0000 (18:26 +0100)
This allows re-using the utility without a VPlan object. The helper also
doesn't access any data from VPlan.

llvm/lib/Transforms/Vectorize/VPlan.h
llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp

index d76f739..009913f 100644 (file)
@@ -2680,12 +2680,6 @@ public:
     return map_range(Operands, Fn);
   }
 
-  /// Returns true if \p VPV is uniform after vectorization.
-  bool isUniformAfterVectorization(VPValue *VPV) const {
-    auto RepR = dyn_cast_or_null<VPReplicateRecipe>(VPV->getDef());
-    return !VPV->getDef() || (RepR && RepR->isUniform());
-  }
-
   /// Returns the VPRegionBlock of the vector loop.
   VPRegionBlock *getVectorLoopRegion() {
     return cast<VPRegionBlock>(getEntry()->getSingleSuccessor());
@@ -3061,6 +3055,12 @@ bool onlyFirstLaneUsed(VPValue *Def);
 /// create a new one.
 VPValue *getOrCreateVPValueForSCEVExpr(VPlan &Plan, const SCEV *Expr,
                                        ScalarEvolution &SE);
+
+/// Returns true if \p VPV is uniform after vectorization.
+inline bool isUniformAfterVectorization(VPValue *VPV) {
+  auto RepR = dyn_cast_or_null<VPReplicateRecipe>(VPV->getDef());
+  return !VPV->getDef() || (RepR && RepR->isUniform());
+}
 } // end namespace vputils
 
 } // end namespace llvm
index a8db508..5b98d7c 100644 (file)
@@ -134,7 +134,7 @@ bool VPRecipeBase::mayHaveSideEffects() const {
 void VPLiveOut::fixPhi(VPlan &Plan, VPTransformState &State) {
   auto Lane = VPLane::getLastLaneForVF(State.VF);
   VPValue *ExitValue = getOperand(0);
-  if (Plan.isUniformAfterVectorization(ExitValue))
+  if (vputils::isUniformAfterVectorization(ExitValue))
     Lane = VPLane::getFirstLane();
   Phi->addIncoming(State.get(ExitValue, VPIteration(State.UF - 1, Lane)),
                    State.Builder.GetInsertBlock());