[llvm] [DA] Widening SCEV expressions in strong SIV test to prevent overflow (PR #164704)

Ryotaro Kasuga via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 24 03:27:20 PDT 2025


kasuga-fj wrote:

> But isn't that isKnownPredicate always going to fail in the case where the multiply may overflow? That means that the value is potentially larger than the original type, and AbsDelta fits within that type. Maybe I'm misunderstanding something here.

I generally agree with this. Maybe the one mistake here is that `AbsDelta` is (the absolute value of) the result of subtracting two values (`SrcConst - DstConst`), so it may also exceed the bounds of the original type. However, for `isKnownPredicate` being true when the multiply *may* overflow, we must ensure that the subtraction *must* overflow so that AbsDelta is guaranteed to be larger than the original type. I think this is a very rare case.

> By the way, it should be possible to write a test for this using `-da-enable-dependence-test`, to test the fix for SDIV even if RDIV is still buggy.

Maybe we should land https://github.com/llvm/llvm-project/pull/164246 first.


https://github.com/llvm/llvm-project/pull/164704


More information about the llvm-commits mailing list