mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-04-11 16:37:42 +00:00
Make ConstantRange::truncate a bit more efficient.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@145122 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
9d399b1fc2
commit
b3ff49e923
@ -466,10 +466,8 @@ ConstantRange ConstantRange::signExtend(uint32_t DstTySize) const {
|
||||
/// correspond to the possible range of values as if the source range had been
|
||||
/// truncated to the specified type.
|
||||
ConstantRange ConstantRange::truncate(uint32_t DstTySize) const {
|
||||
unsigned SrcTySize = getBitWidth();
|
||||
assert(SrcTySize > DstTySize && "Not a value truncation");
|
||||
APInt Size(APInt::getLowBitsSet(SrcTySize, DstTySize));
|
||||
if (isFullSet() || getSetSize().ugt(Size))
|
||||
assert(getBitWidth() > DstTySize && "Not a value truncation");
|
||||
if (isFullSet() || getSetSize().getActiveBits() > DstTySize)
|
||||
return ConstantRange(DstTySize, /*isFullSet=*/true);
|
||||
|
||||
return ConstantRange(Lower.trunc(DstTySize), Upper.trunc(DstTySize));
|
||||
|
Loading…
x
Reference in New Issue
Block a user