mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-10 22:00:58 +00:00
[ValueTracking] Don't special case wrapped ConstantRanges; NFCI
Use `getUnsignedMax` directly instead of special casing a wrapped ConstantRange. The previous code would have been "buggy" (and this would have been a semantic change) if LLVM allowed !range metadata to denote full ranges. E.g. in %val = load i1, i1* %ptr, !range !{i1 1, i1 1} ;; == full set ValueTracking would conclude that the high bit (IOW the only bit) in %val was zero. Since !range metadata does not allow empty or full ranges, this change is just a minor stylistic improvement. llvm-svn: 251380
This commit is contained in:
parent
7530f47511
commit
0cf0546748
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user