[llvm] [AMDGPU] PromoteAlloca: reject known out-of-bounds index (PR #139700)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Tue May 13 03:10:11 PDT 2025


================
@@ -438,7 +438,8 @@ static Value *GEPToVectorIndex(GetElementPtrInst *GEP, AllocaInst *Alloca,
   SmallMapVector<Value *, APInt, 4> VarOffsets;
   APInt ConstOffset(BW, 0);
   if (GEP->getPointerOperand()->stripPointerCasts() != Alloca ||
-      !GEP->collectOffset(DL, BW, VarOffsets, ConstOffset))
+      !GEP->collectOffset(DL, BW, VarOffsets, ConstOffset) ||
+      ConstOffset.getZExtValue() >= Alloca->getAllocationSize(DL))
----------------
arsenm wrote:

You shouldn't need to consider the out of bounds here, this seems far removed from the failure point and condition 

https://github.com/llvm/llvm-project/pull/139700


More information about the llvm-commits mailing list