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

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 3 20:26:14 PST 2025


================
@@ -456,10 +456,21 @@ 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 *Scaled = nullptr;
+  if (Rem != 0 || OffsetQuot.isZero()) {
+    unsigned ElemSizeShift = Log2_64(VecElemSize);
----------------
arsenm wrote:

Need to validate VecElemSize is a power of 2? 

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


More information about the llvm-commits mailing list