[llvm] [AMDGPU] Treat GEP offsets as signed in AMDGPUPromoteAlloca (PR #157682)

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 10 05:32:14 PDT 2025


================
@@ -443,9 +443,10 @@ static Value *GEPToVectorIndex(GetElementPtrInst *GEP, AllocaInst *Alloca,
     return nullptr;
 
   APInt IndexQuot;
-  uint64_t Rem;
-  APInt::udivrem(ConstOffset, VecElemSize, IndexQuot, Rem);
-  if (Rem != 0)
+  APInt Rem;
+  APInt::sdivrem(ConstOffset, APInt(ConstOffset.getBitWidth(), VecElemSize),
----------------
jayfoad wrote:

I think you could still use the form of sdivrem that takes an int64_t dividor, right? Here and below.

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


More information about the llvm-commits mailing list