mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-20 16:17:38 +00:00
make ConstantRange::zeroExtend() optimal
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160643 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -427,9 +427,13 @@ ConstantRange ConstantRange::zeroExtend(uint32_t DstTySize) const {
|
||||
|
||||
unsigned SrcTySize = getBitWidth();
|
||||
assert(SrcTySize < DstTySize && "Not a value extension");
|
||||
if (isFullSet() || isWrappedSet())
|
||||
if (isFullSet() || isWrappedSet()) {
|
||||
// Change into [0, 1 << src bit width)
|
||||
return ConstantRange(APInt(DstTySize,0), APInt(DstTySize,1).shl(SrcTySize));
|
||||
APInt LowerExt(DstTySize, 0);
|
||||
if (!Upper) // special case: [X, 0) -- not really wrapping around
|
||||
LowerExt = Lower.zext(DstTySize);
|
||||
return ConstantRange(LowerExt, APInt(DstTySize, 1).shl(SrcTySize));
|
||||
}
|
||||
|
||||
return ConstantRange(Lower.zext(DstTySize), Upper.zext(DstTySize));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user