[llvm] [DependenceAnalysis] Extending SIV to handle fusable loops (PR #128782)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 19 14:05:23 PDT 2025
amehsan wrote:
> * The overflow I’m referring to here is not in the original program, but in the arithmetic operations inside DA.
>
> These issues violate the assumptions of the underlying algorithm, which can lead to incorrect results. Your example `foo2` seems to be one such case (though I’m not exactly sure what happens where). I’m trying to address this problem in #154527 by proving that signed-wrap does not occur when `nsw` is attached to an AddRec. The example I raised (with a loop guard `if (i < 2147483640)`) is slightly different from yours, since the AddRec corresponding to `i + j * 4294967296` has the `nsw` flag. However, it turns out that checking this flag alone is not sufficient. I’m almost certain now that loop guards need to be checked _somewhere_ in DA, regardless of whether the loops can be fused or not...
>
No worries. Let's continue the work and we can also help to improve the quality of DA. I didn't know about your issue, and I opened a new one. We can close it if it is a duplicate.
We can continue the discussion on the issue pages. But I strongly disagree with checking the loop guards. I will add a more detailed comment on one of the issue pages.
https://github.com/llvm/llvm-project/pull/128782
More information about the llvm-commits
mailing list