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

Robert Imschweiler via llvm-commits llvm-commits at lists.llvm.org
Tue May 13 06:56:10 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))
----------------
ro-i wrote:

Hm, so you think I should replace it with poison for shufflevector?

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


More information about the llvm-commits mailing list