@@ -3249,30 +3249,12 @@ KnownBits SelectionDAG::computeKnownBits(SDValue Op, const APInt &DemandedElts,
3249
3249
Known = KnownBits::computeForAddCarry (Known, Known2, Carry);
3250
3250
break ;
3251
3251
}
3252
- case ISD::SREM:
3253
- if (ConstantSDNode *Rem = isConstOrConstSplat (Op.getOperand (1 ))) {
3254
- const APInt &RA = Rem->getAPIntValue ().abs ();
3255
- if (RA.isPowerOf2 ()) {
3256
- APInt LowBits = RA - 1 ;
3257
- Known2 = computeKnownBits (Op.getOperand (0 ), DemandedElts, Depth + 1 );
3258
-
3259
- // The low bits of the first operand are unchanged by the srem.
3260
- Known.Zero = Known2.Zero & LowBits;
3261
- Known.One = Known2.One & LowBits;
3262
-
3263
- // If the first operand is non-negative or has all low bits zero, then
3264
- // the upper bits are all zero.
3265
- if (Known2.isNonNegative () || LowBits.isSubsetOf (Known2.Zero ))
3266
- Known.Zero |= ~LowBits;
3267
-
3268
- // If the first operand is negative and not all low bits are zero, then
3269
- // the upper bits are all one.
3270
- if (Known2.isNegative () && LowBits.intersects (Known2.One ))
3271
- Known.One |= ~LowBits;
3272
- assert ((Known.Zero & Known.One ) == 0 &&" Bits known to be one AND zero?" );
3273
- }
3274
- }
3252
+ case ISD::SREM: {
3253
+ Known = computeKnownBits (Op.getOperand (0 ), DemandedElts, Depth + 1 );
3254
+ Known2 = computeKnownBits (Op.getOperand (1 ), DemandedElts, Depth + 1 );
3255
+ Known = KnownBits::srem (Known, Known2);
3275
3256
break ;
3257
+ }
3276
3258
case ISD::UREM: {
3277
3259
Known = computeKnownBits (Op.getOperand (0 ), DemandedElts, Depth + 1 );
3278
3260
Known2 = computeKnownBits (Op.getOperand (1 ), DemandedElts, Depth + 1 );
0 commit comments