[llvm] [SCEV] Preserve flags in SCEVLoopGuardRewriter for add and mul. (PR #91472)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Thu May 9 06:16:20 PDT 2024
nikic wrote:
> > > SCEVLoopGuardRewriter only replaces operands with equivalent values
> >
> >
> > But aren't the values only equivalent in the scope of the guards, while the generated expressions might potentially have a larger scope?
>
> The patch still uses the flags from the original expression which should be valid for their original scope, so after re-writing with more restricted values they should still be valid for the larger scope (e.g. re-writing `a + nuw b => a +nuw c` with `range(b).contains(range(c))`?
Is it true though that the range is strictly smaller though? If we have `a +nuw b` and you rewrite this to `a +nuw umax(b, c)` based on a b >= c constraint, can't a +nuw c unsigned wrap outside the constrained scope?
https://github.com/llvm/llvm-project/pull/91472
More information about the llvm-commits
mailing list