summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2016-06-24 20:51:47 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2016-06-24 20:51:47 +0000
commit5f1c01788ea6755edd190f6c140d82565904b9d1 (patch)
treea212ca37edf8d85989d84521890152610e3fcc04 /llvm/lib/Support
parente1e5ac3117515e0ea7234ecd3766facfde5e907f (diff)
downloadbcm5719-llvm-5f1c01788ea6755edd190f6c140d82565904b9d1.tar.gz
bcm5719-llvm-5f1c01788ea6755edd190f6c140d82565904b9d1.zip
[APInt] Don't shift into the sign bit
This fixes PR28294. llvm-svn: 273722
Diffstat (limited to 'llvm/lib/Support')
-rw-r--r--llvm/lib/Support/APInt.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Support/APInt.cpp b/llvm/lib/Support/APInt.cpp
index cd7b9a9980d..348f807c91a 100644
--- a/llvm/lib/Support/APInt.cpp
+++ b/llvm/lib/Support/APInt.cpp
@@ -555,8 +555,8 @@ bool APInt::ult(const APInt& RHS) const {
bool APInt::slt(const APInt& RHS) const {
assert(BitWidth == RHS.BitWidth && "Bit widths must be same for comparison");
if (isSingleWord()) {
- int64_t lhsSext = (int64_t(VAL) << (64-BitWidth)) >> (64-BitWidth);
- int64_t rhsSext = (int64_t(RHS.VAL) << (64-BitWidth)) >> (64-BitWidth);
+ int64_t lhsSext = SignExtend64(VAL, BitWidth);
+ int64_t rhsSext = SignExtend64(RHS.VAL, BitWidth);
return lhsSext < rhsSext;
}
OpenPOWER on IntegriCloud