Min and InfinityMin of boolean should be false.
PiperOrigin-RevId: 370759584
This commit is contained in:
parent
b2a23bf269
commit
565856acd1
|
@ -100,10 +100,11 @@ static APFloat GetScalarLimitOfFloatType(FloatType float_ty,
|
||||||
static APInt GetScalarLimitOfIntegerType(IntegerType integer_ty,
|
static APInt GetScalarLimitOfIntegerType(IntegerType integer_ty,
|
||||||
ScalarLimit limit) {
|
ScalarLimit limit) {
|
||||||
unsigned width = integer_ty.getWidth();
|
unsigned width = integer_ty.getWidth();
|
||||||
|
bool is_bool = (width == 1);
|
||||||
switch (limit) {
|
switch (limit) {
|
||||||
case kLowest:
|
case kLowest:
|
||||||
case kInfinityLowest:
|
case kInfinityLowest:
|
||||||
if (integer_ty.isUnsigned()) {
|
if (integer_ty.isUnsigned() || is_bool) {
|
||||||
return APInt::getMinValue(width);
|
return APInt::getMinValue(width);
|
||||||
} else {
|
} else {
|
||||||
return APInt::getSignedMinValue(width);
|
return APInt::getSignedMinValue(width);
|
||||||
|
@ -111,7 +112,7 @@ static APInt GetScalarLimitOfIntegerType(IntegerType integer_ty,
|
||||||
|
|
||||||
case kMax:
|
case kMax:
|
||||||
case kInfinityMax:
|
case kInfinityMax:
|
||||||
if (integer_ty.isUnsigned()) {
|
if (integer_ty.isUnsigned() || is_bool) {
|
||||||
return APInt::getMaxValue(width);
|
return APInt::getMaxValue(width);
|
||||||
} else {
|
} else {
|
||||||
return APInt::getSignedMaxValue(width);
|
return APInt::getSignedMaxValue(width);
|
||||||
|
|
Loading…
Reference in New Issue