[clang] [llvm] [LLVM] Pass correct offset type to CreatePtrAdd() (PR #238347)

Antonio Frighetto via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 3 06:46:04 PST 2026


================
@@ -565,8 +565,7 @@ Value *SafeStack::moveStaticAllocasToUnsafeStack(
 
   if (StackGuardSlot) {
     unsigned Offset = SSL.getObjectOffset(StackGuardSlot);
-    Value *Off =
-        IRB.CreatePtrAdd(BasePointer, ConstantInt::get(Int32Ty, -Offset));
+    Value *Off = IRB.CreatePtrAddWithSignedOffset(BasePointer, (int)-Offset);
----------------
antoniofrighetto wrote:

Nit, maybe:
```suggestion
    Value *Off = IRB.CreatePtrAddWithSignedOffset(BasePointer, -(int64_t)Offset);
```
(Same below.)

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


More information about the cfe-commits mailing list