From 01fa764c9a3473f2c63241ac5e874019e666f405 Mon Sep 17 00:00:00 2001 From: Florian Hahn Date: Sat, 6 May 2023 09:25:46 +0100 Subject: [PATCH] [VPlan] Assert instead of check if VF is vector when widening GEPs(NFC) VPWidenGEPRecipe should not be generated for scalar VFs. Replace check with an assert. --- llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp index 82cd7e91e345..6c2a38b16466 100644 --- a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp +++ b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp @@ -787,6 +787,7 @@ void VPScalarIVStepsRecipe::print(raw_ostream &O, const Twine &Indent, #endif void VPWidenGEPRecipe::execute(VPTransformState &State) { + assert(State.VF.isVector() && "not widening"); auto *GEP = cast(getUnderlyingInstr()); // Construct a vector GEP by widening the operands of the scalar GEP as // necessary. We mark the vector GEP 'inbounds' if appropriate. A GEP @@ -794,7 +795,7 @@ void VPWidenGEPRecipe::execute(VPTransformState &State) { // is vector-typed. Thus, to keep the representation compact, we only use // vector-typed operands for loop-varying values. - if (State.VF.isVector() && areAllOperandsInvariant()) { + if (areAllOperandsInvariant()) { // If we are vectorizing, but the GEP has only loop-invariant operands, // the GEP we build (by only using vector-typed operands for // loop-varying values) would be a scalar pointer. Thus, to ensure we