[llvm] 1d7bfb7 - [SafeStack] Use getSigned() for negative value

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 12 02:15:56 PST 2025


Author: Nikita Popov
Date: 2025-12-12T11:15:44+01:00
New Revision: 1d7bfb752f7f35180c8a84d067b1715610bf0c39

URL: https://github.com/llvm/llvm-project/commit/1d7bfb752f7f35180c8a84d067b1715610bf0c39
DIFF: https://github.com/llvm/llvm-project/commit/1d7bfb752f7f35180c8a84d067b1715610bf0c39.diff

LOG: [SafeStack] Use getSigned() for negative value

Added: 
    

Modified: 
    llvm/lib/CodeGen/SafeStack.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/SafeStack.cpp b/llvm/lib/CodeGen/SafeStack.cpp
index 782898f430c19..1c109a1f9fed1 100644
--- a/llvm/lib/CodeGen/SafeStack.cpp
+++ b/llvm/lib/CodeGen/SafeStack.cpp
@@ -685,8 +685,8 @@ void SafeStack::moveDynamicAllocasToUnsafeStack(
                           StackAlignment);
 
     Value *NewTop = IRB.CreateIntToPtr(
-        IRB.CreateAnd(SP,
-                      ConstantInt::get(IntPtrTy, ~uint64_t(Align.value() - 1))),
+        IRB.CreateAnd(
+            SP, ConstantInt::getSigned(IntPtrTy, ~uint64_t(Align.value() - 1))),
         StackPtrTy);
 
     // Save the stack pointer.


        


More information about the llvm-commits mailing list