[llvm] 01fa764 - [VPlan] Assert instead of check if VF is vector when widening GEPs(NFC)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Sat May 6 01:26:21 PDT 2023


Author: Florian Hahn
Date: 2023-05-06T09:25:56+01:00
New Revision: 01fa764c9a3473f2c63241ac5e874019e666f405

URL: https://github.com/llvm/llvm-project/commit/01fa764c9a3473f2c63241ac5e874019e666f405
DIFF: https://github.com/llvm/llvm-project/commit/01fa764c9a3473f2c63241ac5e874019e666f405.diff

LOG: [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.

Added: 
    

Modified: 
    llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp

Removed: 
    


################################################################################
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<GetElementPtrInst>(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


        


More information about the llvm-commits mailing list