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

Fabian Ritter via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 10 07:23:56 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),
----------------
ritter-x2a wrote:

Indeed, I've missed that variant. I opened PR #157864 to address this and your other comment; I'd rather not revert this PR for NFC improvements since it fixed a buildbot failure.

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


More information about the llvm-commits mailing list