[llvm] [AMDGPU] Enable i8 GEP promotion for vector allocas (PR #166132)

Shilei Tian via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 18 10:22:58 PST 2025


================
@@ -456,10 +456,25 @@ static Value *GEPToVectorIndex(GetElementPtrInst *GEP, AllocaInst *Alloca,
   const auto &VarOffset = VarOffsets.front();
   APInt OffsetQuot;
   APInt::sdivrem(VarOffset.second, VecElemSize, OffsetQuot, Rem);
-  if (Rem != 0 || OffsetQuot.isZero())
-    return nullptr;
-
   Value *Offset = VarOffset.first;
+  if (Rem != 0 || OffsetQuot.isZero()) {
----------------
shiltian wrote:

Does it have to be this complicated? I thought checking whether `offset % size` would be sufficient?

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


More information about the llvm-commits mailing list