mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-14 14:24:05 +00:00
teach ConstantRange that zero times X is always zero
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160317 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -537,6 +537,12 @@ ConstantRange::multiply(const ConstantRange &Other) const {
|
||||
|
||||
if (isEmptySet() || Other.isEmptySet())
|
||||
return ConstantRange(getBitWidth(), /*isFullSet=*/false);
|
||||
|
||||
// If any of the operands is zero, then the result is also zero.
|
||||
if ((getSingleElement() && *getSingleElement() == 0) ||
|
||||
(Other.getSingleElement() && *Other.getSingleElement() == 0))
|
||||
return ConstantRange(APInt(getBitWidth(), 0));
|
||||
|
||||
if (isFullSet() || Other.isFullSet())
|
||||
return ConstantRange(getBitWidth(), /*isFullSet=*/true);
|
||||
|
||||
|
Reference in New Issue
Block a user