mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-15 05:24:01 +00:00
make ConstantRange::signExtend() optimal
the case [x, INT_MIN) was not handled optimally git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193694 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -445,6 +445,11 @@ ConstantRange ConstantRange::signExtend(uint32_t DstTySize) const {
|
||||
|
||||
unsigned SrcTySize = getBitWidth();
|
||||
assert(SrcTySize < DstTySize && "Not a value extension");
|
||||
|
||||
// special case: [X, INT_MIN) -- not really wrapping around
|
||||
if (Upper == APInt::getHighBitsSet(SrcTySize, 1))
|
||||
return ConstantRange(Lower.sext(DstTySize), Upper.zext(DstTySize));
|
||||
|
||||
if (isFullSet() || isSignWrappedSet()) {
|
||||
return ConstantRange(APInt::getHighBitsSet(DstTySize,DstTySize-SrcTySize+1),
|
||||
APInt::getLowBitsSet(DstTySize, SrcTySize-1) + 1);
|
||||
|
Reference in New Issue
Block a user