summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFangrui Song <maskray@google.com>2018-11-07 21:14:54 +0000
committerFangrui Song <maskray@google.com>2018-11-07 21:14:54 +0000
commitdb22af0f45c4782d8488e191f406b7aa65e4b62e (patch)
treecd4070ffcd241d22a2922a7c487280c8ce75ba4b
parent7d7d41debc9abdda7b3710cdabe2bc64e03d5578 (diff)
downloadbcm5719-llvm-db22af0f45c4782d8488e191f406b7aa65e4b62e.tar.gz
bcm5719-llvm-db22af0f45c4782d8488e191f406b7aa65e4b62e.zip
[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 llvm-svn: 346356
-rw-r--r--lld/ELF/Arch/PPC64.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/lld/ELF/Arch/PPC64.cpp b/lld/ELF/Arch/PPC64.cpp
index 2380929faa0..4613179df16 100644
--- a/lld/ELF/Arch/PPC64.cpp
+++ b/lld/ELF/Arch/PPC64.cpp
@@ -847,8 +847,7 @@ bool PPC64::adjustPrologueForCrossSplitStack(uint8_t *Loc, uint8_t *End,
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;
}
OpenPOWER on IntegriCloud