From: Florian Hahn Date: Tue, 9 May 2023 14:17:20 +0000 (+0100) Subject: [VPlan] Address missed suggestions from D149082. X-Git-Tag: upstream/17.0.6~9009 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c096e91735397e2f2892ede9ece50bf4693d94ac;p=platform%2Fupstream%2Fllvm.git [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. --- diff --git a/llvm/lib/Transforms/Vectorize/VPlan.h b/llvm/lib/Transforms/Vectorize/VPlan.h index 95b8371..6392a5a 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 @@ public: 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 596afc9..37b0308 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(NewGEP)) - setFlags(I); + Indices, "", isInBounds()); assert((State.VF.isScalar() || NewGEP->getType()->isVectorTy()) && "NewGEP is not a pointer vector"); State.set(this, NewGEP, Part);