[llvm] [SCEVDivision] Prevent propagation of incorrect no-wrap flags (PR #154745)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 21 06:32:33 PDT 2025


nikic wrote:

> For the nowrap flags, I think you can justify preserving `nuw` because division should make everything strictly smaller in an unsigned sense. So if it did not wrap with larger values, it should not wrap with smaller ones. The caveat here is that this is not correct for division by zero. We can't preserve flags for a possible division by zero.

Nevermind, I just realized that this code is performing signed division, not unsigned.

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


More information about the llvm-commits mailing list