[llvm] [LoopFusion] Allow fusing adjacent loops with same-iteration scalar deps (PR #216242)

Madhur Amilkanthwar via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 13 22:08:10 PDT 2026


================
@@ -1165,6 +1165,17 @@ struct LoopFuser {
         NumDA++;
         return true;
       }
+      // Same-iteration scalar flow/anti dependences between adjacent loops are
+      // preserved by placing FC0's body before FC1's body in the fused loop.
+      // This enables fusing accumulation chains such as:
+      //   for (i) A[i] = ...;  for (i) A[i] += ...;
----------------
madhur13490 wrote:

You can have the loop on separate lines with proper indentation.

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


More information about the llvm-commits mailing list