[llvm] [DA] Add tests for nsw doesn't hold on entier iteration (PR #162281)
Ryotaro Kasuga via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 7 04:45:28 PST 2025
https://github.com/kasuga-fj commented:
I still think we need to handle loop guards properly in some way, and I believe the test case `@nsw_under_loop_guard0` illustrates why. What I'm trying to say is:
- Monotonicity reasoning based on the nowrap property in addrecs may only be valid under loop guards
- Each dependence testing function in DA basically assumes monotonicity across the entire iteration space. E.g., it evaluates an addrec at a BTC and treats the result as the minimum or maximum value of the addrec.
That is, there is a gap between the information provided by the monotonicity check and the assumptions made by the dependence testing functions. To bridge this gap, we may need to either:
- Pessimistically reject cases where loop guards are present, or
- Prove that the gap does not lead to unsoundness in dependence testing.
It's also true that I haven't found any cases where this gap actually causes problems, so it might be possible to prove that the gap is harmless.
@Meinersbur What do you think?
https://github.com/llvm/llvm-project/pull/162281
More information about the llvm-commits
mailing list