@@ -1258,9 +1258,7 @@ static void computeKnownBitsFromOperator(const Operator *I, APInt &KnownZero,
12581258 unsigned Opcode = LU->getOpcode ();
12591259 // Check for operations that have the property that if
12601260 // both their operands have low zero bits, the result
1261- // will have low zero bits. Also check for operations
1262- // that are known to produce non-negative or negative
1263- // recurrence values.
1261+ // will have low zero bits.
12641262 if (Opcode == Instruction::Add ||
12651263 Opcode == Instruction::Sub ||
12661264 Opcode == Instruction::And ||
@@ -1286,40 +1284,6 @@ static void computeKnownBitsFromOperator(const Operator *I, APInt &KnownZero,
12861284 KnownZero = APInt::getLowBitsSet (BitWidth,
12871285 std::min (KnownZero2.countTrailingOnes (),
12881286 KnownZero3.countTrailingOnes ()));
1289-
1290- auto *OverflowOp = dyn_cast<OverflowingBinaryOperator>(LU);
1291- if (OverflowOp && OverflowOp->hasNoSignedWrap ()) {
1292- // If initial value of recurrence is nonnegative, and we are adding
1293- // a nonnegative number with nsw, the result can only be nonnegative
1294- // or poison value regardless of the number of times we execute the
1295- // add in phi recurrence. If initial value is negative and we are
1296- // adding a negative number with nsw, the result can only be
1297- // negative or poison value. Similar arguments apply to sub and mul.
1298- //
1299- // (add non-negative, non-negative) --> non-negative
1300- // (add negative, negative) --> negative
1301- if (Opcode == Instruction::Add) {
1302- if (KnownZero2.isNegative () && KnownZero3.isNegative ())
1303- KnownZero.setBit (BitWidth - 1 );
1304- else if (KnownOne2.isNegative () && KnownOne3.isNegative ())
1305- KnownOne.setBit (BitWidth - 1 );
1306- }
1307-
1308- // (sub nsw non-negative, negative) --> non-negative
1309- // (sub nsw negative, non-negative) --> negative
1310- else if (Opcode == Instruction::Sub && LL == I) {
1311- if (KnownZero2.isNegative () && KnownOne3.isNegative ())
1312- KnownZero.setBit (BitWidth - 1 );
1313- else if (KnownOne2.isNegative () && KnownZero3.isNegative ())
1314- KnownOne.setBit (BitWidth - 1 );
1315- }
1316-
1317- // (mul nsw non-negative, non-negative) --> non-negative
1318- else if (Opcode == Instruction::Mul && KnownZero2.isNegative () &&
1319- KnownZero3.isNegative ())
1320- KnownZero.setBit (BitWidth - 1 );
1321- }
1322-
13231287 break ;
13241288 }
13251289 }
0 commit comments