Skip to content

Commit 326ba38

Browse files
authored
[ValueTracking][RISCV] Use ConstantRange::getUnsignedMax instead of getUpper to simplify some code. (#96816)
This avoids the need to subtract 1 and explain why.
1 parent ca4e5a8 commit 326ba38

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

llvm/lib/Analysis/ValueTracking.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1740,10 +1740,8 @@ static void computeKnownBitsFromOperator(const Operator *I,
17401740
cast<ConstantInt>(II->getArgOperand(HasAVL))->getZExtValue());
17411741
RISCVII::VLMUL VLMUL = static_cast<RISCVII::VLMUL>(
17421742
cast<ConstantInt>(II->getArgOperand(1 + HasAVL))->getZExtValue());
1743-
// The Range is [Lower, Upper), so we need to subtract 1 here to get the
1744-
// real upper value.
17451743
uint64_t MaxVLEN =
1746-
(Range.getUpper().getZExtValue() - 1) * RISCV::RVVBitsPerBlock;
1744+
Range.getUnsignedMax().getZExtValue() * RISCV::RVVBitsPerBlock;
17471745
uint64_t MaxVL = MaxVLEN / RISCVVType::getSEWLMULRatio(SEW, VLMUL);
17481746

17491747
// Result of vsetvli must be not larger than AVL.

0 commit comments

Comments
 (0)