[llvm] [DependenceAnalysis] Extending SIV to handle fusable loops (PR #128782)

via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 17 12:15:11 PDT 2025


amehsan wrote:

> I believe this issue will be fixed by checking the loop-guard and/or `nsw`/`nuw` properly. 

Need to do more investigation. But checking the loop guard in DA is almost certainly incorrect. One evidence is that the following loop with no loop guard has the same problem

```
void foo2 (int *a ) {

  unsigned long long i;
  unsigned long long j;

  for (i = 0; i < 9223372036854775806; i++) {
    for (j = 0; j < 2147483640; j++) {
      a[i + j * 4294967296] = 0;
      a[j * 2] = 0;
    }
  }
}
``` 


> Here, what I'm not confident about is, what happens when assuming the two loops (`%loop.j.0` and `%loop.j.1`) are fused in such cases?

It is a completely orthogonal issue. This particular bug might be in SCEV or in DA (We are looking into it. Please wait). But anyways, not related to this patch. 

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


More information about the llvm-commits mailing list