[llvm] [CGP] Fix missing sign extension for base offset in optimizeMemoryInst (PR #161377)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 9 10:07:14 PDT 2025


================
@@ -6100,7 +6100,7 @@ bool CodeGenPrepare::optimizeMemoryInst(Instruction *MemoryInst, Value *Addr,
 
       // Add in the Base Offset if present.
       if (AddrMode.BaseOffs) {
-        Value *V = ConstantInt::get(IntPtrTy, AddrMode.BaseOffs);
+        Value *V = ConstantInt::get(IntPtrTy, AddrMode.BaseOffs, true);
----------------
nikic wrote:

```suggestion
        Value *V = ConstantInt::getSigned(IntPtrTy, AddrMode.BaseOffs);
```

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


More information about the llvm-commits mailing list