[llvm] [SCEV] Preserve flags in SCEVLoopGuardRewriter for add and mul. (PR #91472)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Fri May 10 11:26:13 PDT 2024


fhahn wrote:

> 
> 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?

I originally thought so, but there are some cases where that's not the case when checking via asserts (not sure if the replacement helps in general in such cases thought).

Updated this PR to check if the replacement ranges are contained in the replaced ranges and only preserve NSW/NUW if they are 

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


More information about the llvm-commits mailing list