[llvm] [DA] Add tests for nsw doesn't hold on entire iteration space (NFC) (PR #162281)
Ryotaro Kasuga via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 27 12:10:54 PST 2025
================
----------------
kasuga-fj wrote:
> 1- looking at strong SIV code, you have removed 24 lines of code and added 36 lines of code. So your code is more complex.
But we don't need complex proofs like https://github.com/llvm/llvm-project/pull/162281#issuecomment-3564376265. I really want to avoid relying on such a proof because:
- It's complex and easy to get wrong
- It strongly depends on specific parts of the implementation
- Some minor changes in the code can easily break the proof
> 2- How do you know nsw is valid for first or last iteration of the loop?
For the innermost addrec, if the exact BTC is computable, nowrap property should be valid for every iteration.
> 3- This is more compile time intensive than previous approach. Just a quick look at the SCEV related computations in your approach it seems more expensive than the previous approach
It's not trivial. If you haven't seen it, I'd strongly recommend taking a look at the implementation of SCEV. For example, `willNotOverflow` performs same operation twice, with two different bitwidth.
https://github.com/llvm/llvm-project/pull/162281
More information about the llvm-commits
mailing list