[llvm-branch-commits] [llvm] [Vectorizer] fix GEPs incorrectly marked as "inbounds" (PR #120730)
Florian Hahn via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Fri Dec 20 05:47:45 PST 2024
================
@@ -1986,10 +1986,10 @@ void VPReverseVectorPointerRecipe::execute(VPTransformState &State) {
// LastLane = 1 - RunTimeVF
Value *LastLane = Builder.CreateSub(ConstantInt::get(IndexTy, 1), RunTimeVF);
Value *Ptr = State.get(getOperand(0), VPLane(0));
- Value *ResultPtr =
- Builder.CreateGEP(IndexedTy, Ptr, NumElt, "", getGEPNoWrapFlags());
- ResultPtr = Builder.CreateGEP(IndexedTy, ResultPtr, LastLane, "",
- getGEPNoWrapFlags());
+ // N.B. we deliberately do not use getGEPNoWrapFlags here, because this
+ // transform can invalidate `inbounds`.
+ Value *ResultPtr = Builder.CreateGEP(IndexedTy, Ptr, NumElt, "");
+ ResultPtr = Builder.CreateGEP(IndexedTy, ResultPtr, LastLane, "");
----------------
fhahn wrote:
I might be missing something, but ithe inbounds is still not added here when creating the pointer, but it should also not be added to the recipe on construction of the recipe.
https://github.com/llvm/llvm-project/pull/120730
More information about the llvm-branch-commits
mailing list