[ValueTracking] Don't special case wrapped ConstantRanges; NFCI
[oota-llvm.git] / lib / Analysis / ValueTracking.cpp
index 1171149180bf74312e4f7bd2b0c661ec7c672c00..e25087e6911c5ace3e7cb5ba94e0b8f3c982a832 100644 (file)
@@ -380,9 +380,7 @@ void llvm::computeKnownBitsFromRangeMetadata(const MDNode &Ranges,
     ConstantInt *Upper =
         mdconst::extract<ConstantInt>(Ranges.getOperand(2 * i + 1));
     ConstantRange Range(Lower->getValue(), Upper->getValue());
-    if (Range.isWrappedSet())
-      MinLeadingZeros = 0; // -1 has no zeros
-    unsigned LeadingZeros = (Upper->getValue() - 1).countLeadingZeros();
+    unsigned LeadingZeros = Range.getUnsignedMax().countLeadingZeros();
     MinLeadingZeros = std::min(LeadingZeros, MinLeadingZeros);
   }