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

Ryotaro Kasuga via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 15 11:18:27 PDT 2025


================
@@ -221,13 +250,28 @@ static bool populateDependencyMatrix(CharMatrix &DepMatrix, unsigned Level,
           Dep.push_back('I');
         }
 
+        auto [Ite, Inserted] = Seen.try_emplace(
+            StringRef(Dep.data(), Dep.size()), DepMatrix.size());
+
         // Make sure we only add unique entries to the dependency matrix.
-        if (Seen.insert(StringRef(Dep.data(), Dep.size())).second)
+        if (Inserted) {
           DepMatrix.push_back(Dep);
+          IsForwardFlags.push_back(true);
+        }
+        if (!IsForward)
+          IsForwardFlags.reset(Ite->second);
----------------
kasuga-fj wrote:

I don't remember why I delayed it… For now, it seems reasonable to just add the last element immediately.

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


More information about the llvm-commits mailing list