1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 19:42:54 +02:00

[APInt] Don't shift into the sign bit

This fixes PR28294.

llvm-svn: 273722
This commit is contained in:
David Majnemer 2016-06-24 20:51:47 +00:00
parent c9778ed077
commit 60b0be69b7

View File

@ -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;
}