Merging r258690:
[oota-llvm.git] / lib / Analysis / DemandedBits.cpp
index 6f92ba6289a4ac5a6676e936e65f095261b7e621..143d0b79f188e5f59372ddd1a2231acf1cfa0747 100644 (file)
@@ -242,6 +242,13 @@ void DemandedBits::determineLiveOperandBits(
     if (OperandNo != 0)
       AB = AOut;
     break;
+  case Instruction::ICmp:
+    // Count the number of leading zeroes in each operand.
+    ComputeKnownBits(BitWidth, UserI->getOperand(0), UserI->getOperand(1));
+    auto NumLeadingZeroes = std::min(KnownZero.countLeadingOnes(),
+                                     KnownZero2.countLeadingOnes());
+    AB = ~APInt::getHighBitsSet(BitWidth, NumLeadingZeroes);
+    break;
   }
 }