[llvm] [AMDGPU] Support i8/i16 GEP indices when promoting allocas to vectors (PR #175489)

Harrison Hao via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 20 23:15:04 PST 2026


================
@@ -568,15 +572,31 @@ computeGEPToVectorIndex(GetElementPtrInst *GEP, AllocaInst *Alloca,
   const auto &VarOffset = VarOffsets.front();
   APInt OffsetQuot;
   APInt::sdivrem(VarOffset.second, VecElemSize, OffsetQuot, Rem);
-  if (Rem != 0 || OffsetQuot.isZero())
+  uint64_t DivForVarIndex = 0;
+  if (Rem != 0) {
+    uint64_t Scale = VarOffset.second.getZExtValue();
+    if (Scale == 0 || (VecElemSize % Scale) != 0)
+      return {};
----------------
harrisonGPU wrote:

I added an odd test, but it doesn’t check this path, because promotion is already blocked earlier.

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


More information about the llvm-commits mailing list