[llvm] [LoopFusion] Remove DT edge from Extiblock to ExitBlockSuc (PR #193641)

Ehsan Amiri via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 23 06:57:30 PDT 2026


https://github.com/amehsan commented:

You have an interesting testcase and it might be exposing more than one problem.

One issue that I noticed is this:

You have two guarded loops with different guards. Loop Fusion is not capable of fusing this two loops. But the check looks like this:

```
        if (FC0.GuardBranch && FC1.GuardBranch &&
            !haveIdenticalGuards(FC0, FC1) && !TCDifference) 
```

So when `TCDifference` is set, the whole condition becomes `false` and we continue trying to fuse this two loops even though `haveIdenticalGuards(FC0, FC1)` is false.

I think first problem that we need to fix is this. (We might still need your current fix, but this testcase exposes and earlier problem that needs to be fixed first).

Another issue that looks suspicious is that the two loops have iteration counts 100 and 99 and the first loop should be peeled once, but from what I see in the IR it seems that the first loops is peeled twice? Could you check that as well?

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


More information about the llvm-commits mailing list