[lld] r346356 - [PPC64] Use INT32_MIN instead of std::numeric_limits<int32_t>::min()
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 7 13:14:55 PST 2018
Author: maskray
Date: Wed Nov 7 13:14:54 2018
New Revision: 346356
URL: http://llvm.org/viewvc/llvm-project?rev=346356&view=rev
Log:
[PPC64] Use INT32_MIN instead of std::numeric_limits<int32_t>::min()
Summary:
D53821 fixed the bogus MSVC (at least 2017) C4146 warning (unary minus applied on unsigned type)
by using std::numeric_limits<int32_t>::min().
The warning was because -2147483648 is incorrectly treated as unsigned long instead of long long)
Let's use INT32_MIN which is arguably more readable.
Note, on GCC or clang, -0x80000000 works fine (ILP64: long, LP64: long long).
Reviewers: ruiu, jhenderson, sfertile, espindola
Reviewed By: sfertile
Subscribers: emaste, nemanjai, arichardson, kbarton, jsji, llvm-commits
Differential Revision: https://reviews.llvm.org/D54200
Modified:
lld/trunk/ELF/Arch/PPC64.cpp
Modified: lld/trunk/ELF/Arch/PPC64.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Arch/PPC64.cpp?rev=346356&r1=346355&r2=346356&view=diff
==============================================================================
--- lld/trunk/ELF/Arch/PPC64.cpp (original)
+++ lld/trunk/ELF/Arch/PPC64.cpp Wed Nov 7 13:14:54 2018
@@ -847,8 +847,7 @@ bool PPC64::adjustPrologueForCrossSplitS
int32_t StackFrameSize = (HiImm * 65536) + LoImm;
// Check that the adjusted size doesn't overflow what we can represent with 2
// instructions.
- if (StackFrameSize <
- std::numeric_limits<int32_t>::min() + Config->SplitStackAdjustSize) {
+ if (StackFrameSize < Config->SplitStackAdjustSize + INT32_MIN) {
error(getErrorLocation(Loc) + "split-stack prologue adjustment overflows");
return false;
}
More information about the llvm-commits
mailing list