and isMinValue methods of ConstantInt. These have been broken since the
isSigned parameter was added. It is necessary to use the signed version
of the type in the call to isValueValidForType or else incorrect results
are returned.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32637
91177308-0d34-0410-b5e6-
96231b3b80d8
int64_t V = getSExtValue();
if (V < 0) return false; // Be careful about wrap-around on 'long's
++V;
- return !isValueValidForType(getType(), V) || V < 0;
+ return !isValueValidForType(getType()->getSignedVersion(), V) || V < 0;
}
return isAllOnesValue();
}
int64_t V = getSExtValue();
if (V > 0) return false; // Be careful about wrap-around on 'long's
--V;
- return !isValueValidForType(getType(), V) || V > 0;
+ return !isValueValidForType(getType()->getSignedVersion(), V) || V > 0;
}
return getZExtValue() == 0;
}