[PATCH] D136277: [LoopInterchange] Simplify DepMatrix to a dependency vector.

Congzhe Cao via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 1 12:59:20 PDT 2022


congzhe added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/LoopInterchange.cpp:154
           } else {
-            unsigned Dir = D->getDirection(II);
-            if (Dir == Dependence::DVEntry::LT ||
-                Dir == Dependence::DVEntry::LE)
-              Direction = '<';
-            else if (Dir == Dependence::DVEntry::GT ||
-                     Dir == Dependence::DVEntry::GE)
-              Direction = '>';
-            else if (Dir == Dependence::DVEntry::EQ)
-              Direction = '=';
-            else
-              Direction = '*';
-            Dep.push_back(Direction);
+            // DepFlags needs lower 3 bits of DepFlags for be the same as used
+            // by DA.
----------------
typo?


================
Comment at: llvm/lib/Transforms/Scalar/LoopInterchange.cpp:179
+    DepFlags Lvl = DepMatrix[i];
+    if (Lvl & LT || Lvl & GT)
       return false;
----------------
Please correct me if I'm wrong - IIUC `Scalar` is considered a type of dependence that prevents interchange?


================
Comment at: llvm/lib/Transforms/Scalar/LoopInterchange.cpp:208
 
+static bool isAnydirectional(DepFlags F) { return (F & LT) && (F & GT); }
+
----------------
If Scalar is considered a type of dependence that prevents interchange, would `isAnydirectional()` be the following?

```
return ((F & LT) && (F & GT)) || (F & Scalar); 
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D136277/new/

https://reviews.llvm.org/D136277



More information about the llvm-commits mailing list