[llvm] [IndVars] Mark truncs as nuw/nsw (PR #88686)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 15 18:45:15 PDT 2024
nikic wrote:
> One of the thoughts I'd had when seeing this langref proposal was that it might allow us to simplify this code significantly. I believe one of the things which makes this code complex is that we have to "commit" to our signed or unsigned interpretation by performing all rewrites at once since we couldn't materialize a wide IV + truncate and preserve the information about the choice. With this IR change, we now have that possibility. This might not fully work out - there's other reasons for complexity in this code - but mentioning it in case it inspires you. :)
Right. What IV widening conceptually does is to zext/sext the IV and then add trunc nuw/nsw at all uses -- and then implement a whole bunch of combines to get rid of that trunc again. That last part is no longer strictly necessary, but I suspect that we do need it in practice for phase ordering reasons: We probably can't leave these truncs around until the next InstCombine run that eliminates them, especially considering interleaved loop passes.
https://github.com/llvm/llvm-project/pull/88686
More information about the llvm-commits
mailing list