[llvm] [LoopInterchange] Improve profitability check for vectorization (PR #133672)

Michael Kruse via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 21 05:26:58 PDT 2025


================
@@ -103,3 +103,135 @@ for.i.inc:
 exit:
   ret void
 }
+
+; Check that the below loops are exchanged to allow innermost loop
+; vectorization. We cannot vectorize the j-loop because it has a lexically
+; backward dependency, but the i-loop can be vectorized because all the
+; loop-carried dependencies are lexically forward.
----------------
Meinersbur wrote:

I think I got confused because it sounds like it was about removing the backward dependency, but its right in the first sentence.

Proposal
```suggestion
; backward dependency, but the i-loop can be vectorized because all the
; loop-carried dependencies are lexically forward. LoopVectorize currently 
; only vectorizes innermost loop, hence move the i-loop to that position.
```

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


More information about the llvm-commits mailing list