[llvm] c096e91 - [VPlan] Address missed suggestions from D149082.

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Tue May 9 07:19:11 PDT 2023


Author: Florian Hahn
Date: 2023-05-09T15:17:20+01:00
New Revision: c096e91735397e2f2892ede9ece50bf4693d94ac

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

LOG: [VPlan] Address missed suggestions from D149082.

This address 2 comments missed from D149082. It sets inbounds directly
when creating the GEP and fixes the order in the enum.

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 95b8371b7490..6392a5a04a11 100644
--- a/llvm/lib/Transforms/Vectorize/VPlan.h
+++ b/llvm/lib/Transforms/Vectorize/VPlan.h
@@ -942,8 +942,8 @@ class VPRecipeWithIRFlags : public VPRecipeBase {
   enum class OperationType : unsigned char {
     OverflowingBinOp,
     PossiblyExactOp,
-    FPMathOp,
     GEPOp,
+    FPMathOp,
     Other
   };
   struct WrapFlagsTy {
@@ -1066,6 +1066,12 @@ class VPRecipeWithIRFlags : public VPRecipeBase {
       break;
     }
   }
+
+  bool isInBounds() const {
+    assert(OpType == OperationType::GEPOp &&
+           "recipe doesn't have inbounds flag");
+    return GEPFlags.IsInBounds;
+  }
 };
 
 /// VPWidenRecipe is a recipe for producing a copy of vector type its

diff  --git a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
index 596afc9e736a..37b03081cb94 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
@@ -835,9 +835,7 @@ void VPWidenGEPRecipe::execute(VPTransformState &State) {
       // Create the new GEP. Note that this GEP may be a scalar if VF == 1,
       // but it should be a vector, otherwise.
       auto *NewGEP = State.Builder.CreateGEP(GEP->getSourceElementType(), Ptr,
-                                             Indices, "");
-      if (auto *I = dyn_cast<GetElementPtrInst>(NewGEP))
-        setFlags(I);
+                                             Indices, "", isInBounds());
       assert((State.VF.isScalar() || NewGEP->getType()->isVectorTy()) &&
              "NewGEP is not a pointer vector");
       State.set(this, NewGEP, Part);


        


More information about the llvm-commits mailing list