[llvm] [LoopInterchange] Consider forward/backward dependency in vectorize heuristic (PR #133672)

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


================
@@ -126,11 +133,32 @@ static bool noDuplicateRulesAndIgnore(ArrayRef<RuleTy> Rules) {
 
 static void printDepMatrix(CharMatrix &DepMatrix) {
   for (auto &Row : DepMatrix) {
-    for (auto D : Row)
+    ArrayRef<char> RowRef(Row);
+
+    // Drop the last element because it is a flag indicating whether this is
+    // forward dependency or not, which doesn't affect the legality check.
+    for (auto D : RowRef.drop_back())
----------------
Meinersbur wrote:

```suggestion
    for (char D : drop_end(RowRef)) // drop_end from STLExtras.h
```
No temporary ArrayRef needed

Almost-always-auto can be updated according to current coding standard when we change the line anyway

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


More information about the llvm-commits mailing list