[llvm] 4e5c449 - [VPlan] Move isUniformAfterVectorization from VPlan to vputils (NFC).
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 26 10:26:48 PDT 2022
Author: Florian Hahn
Date: 2022-08-26T18:26:33+01:00
New Revision: 4e5c44964a7f3ecbe93cd69bdbcbbcf2a5f52c28
URL: https://github.com/llvm/llvm-project/commit/4e5c44964a7f3ecbe93cd69bdbcbbcf2a5f52c28
DIFF: https://github.com/llvm/llvm-project/commit/4e5c44964a7f3ecbe93cd69bdbcbbcf2a5f52c28.diff
LOG: [VPlan] Move isUniformAfterVectorization from VPlan to vputils (NFC).
This allows re-using the utility without a VPlan object. The helper also
doesn't access any data from VPlan.
Added:
Modified:
llvm/lib/Transforms/Vectorize/VPlan.h
llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Vectorize/VPlan.h b/llvm/lib/Transforms/Vectorize/VPlan.h
index d76f73961743..009913f5a5eb 100644
--- a/llvm/lib/Transforms/Vectorize/VPlan.h
+++ b/llvm/lib/Transforms/Vectorize/VPlan.h
@@ -2680,12 +2680,6 @@ class VPlan {
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
diff --git a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
index a8db5084a9a6..5b98d7cea21e 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
@@ -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());
More information about the llvm-commits
mailing list