Fix undefined behavior (left shift of negative value) in SystemZ backend.
This bug is reported by UBSan.
llvm-svn: 216131
diff --git a/llvm/lib/Target/SystemZ/SystemZFrameLowering.cpp b/llvm/lib/Target/SystemZ/SystemZFrameLowering.cpp
index db1a005..eff4ae3 100644
--- a/llvm/lib/Target/SystemZ/SystemZFrameLowering.cpp
+++ b/llvm/lib/Target/SystemZ/SystemZFrameLowering.cpp
@@ -294,7 +294,7 @@
else {
Opcode = SystemZ::AGFI;
// Make sure we maintain 8-byte stack alignment.
- int64_t MinVal = -int64_t(1) << 31;
+ int64_t MinVal = -uint64_t(1) << 31;
int64_t MaxVal = (int64_t(1) << 31) - 8;
if (ThisVal < MinVal)
ThisVal = MinVal;