@@ -1111,9 +1111,9 @@ static void computeKnownBitsFromOperator(const Operator *I,
1111
1111
break;
1112
1112
}
1113
1113
1114
- Value *V;
1114
+ const Value *V;
1115
1115
// Handle bitcast from floating point to integer.
1116
- if (match (const_cast <Operator *>(I) , m_ElementWiseBitCast (m_Value (V))) &&
1116
+ if (match(I , m_ElementWiseBitCast(m_Value(V))) &&
1117
1117
V->getType()->isFPOrFPVectorTy()) {
1118
1118
KnownFPClass Result = computeKnownFPClass(V, fcAllFlags, Depth + 1, Q);
1119
1119
if (Result.SignBit) {
@@ -1126,19 +1126,18 @@ static void computeKnownBitsFromOperator(const Operator *I,
1126
1126
Type *FPType = V->getType()->getScalarType();
1127
1127
if (FPType->isIEEELikeFPTy()) {
1128
1128
int MantissaWidth = FPType->getFPMantissaWidth();
1129
- if (MantissaWidth != -1 ) {
1130
- if (Result.isKnownOnly (fcInf)) {
1131
- Known.Zero .setLowBits (MantissaWidth);
1132
- Known.One .setBits (MantissaWidth, BitWidth - 1 );
1133
- } else if (Result.isKnownOnly (fcZero)) {
1134
- Known.Zero .setLowBits (BitWidth - 1 );
1135
- } else if (Result.isKnownOnly (fcInf | fcNan)) {
1136
- Known.One .setBits (MantissaWidth, BitWidth - 1 );
1137
- } else if (Result.isKnownOnly (fcSubnormal | fcZero)) {
1138
- Known.Zero .setBits (MantissaWidth, BitWidth - 1 );
1139
- } else if (Result.isKnownOnly (fcInf | fcZero)) {
1140
- Known.Zero .setLowBits (MantissaWidth);
1141
- }
1129
+ assert(MantissaWidth != -1 && "Invalid mantissa width");
1130
+ if (Result.isKnownOnly(fcInf)) {
1131
+ Known.Zero.setLowBits(MantissaWidth);
1132
+ Known.One.setBits(MantissaWidth, BitWidth - 1);
1133
+ } else if (Result.isKnownOnly(fcZero)) {
1134
+ Known.Zero.setLowBits(BitWidth - 1);
1135
+ } else if (Result.isKnownOnly(fcInf | fcNan)) {
1136
+ Known.One.setBits(MantissaWidth, BitWidth - 1);
1137
+ } else if (Result.isKnownOnly(fcSubnormal | fcZero)) {
1138
+ Known.Zero.setBits(MantissaWidth, BitWidth - 1);
1139
+ } else if (Result.isKnownOnly(fcInf | fcZero)) {
1140
+ Known.Zero.setLowBits(MantissaWidth);
1142
1141
}
1143
1142
}
1144
1143
0 commit comments