[llvm] [RISCV] Use APInt in isSimpleVIDSequence to account for index overflow (PR #100072)
Pengcheng Wang via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 23 01:52:18 PDT 2024
================
@@ -3408,21 +3412,21 @@ static std::optional<VIDSequence> isSimpleVIDSequence(SDValue Op,
// Calculate the step since the last non-undef element, and ensure
// it's consistent across the entire sequence.
unsigned IdxDiff = Idx - PrevElt->second;
- int64_t ValDiff = SignExtend64(*Elt - PrevElt->first, EltSizeInBits);
+ APInt ValDiff = *Elt - PrevElt->first;
// A zero-value value difference means that we're somewhere in the middle
// of a fractional step, e.g. <0,0,0*,0,1,1,1,1>. Wait until we notice a
// step change before evaluating the sequence.
if (ValDiff == 0)
continue;
- int64_t Remainder = ValDiff % IdxDiff;
+ int64_t Remainder = ValDiff.srem(IdxDiff);
----------------
wangpc-pp wrote:
Should we use `APInt` for `Remainder` too?
https://github.com/llvm/llvm-project/pull/100072
More information about the llvm-commits
mailing list