[llvm] [LoopInterchange] Make the entries of the Dependency Matrix unique (PR #116195)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 18 11:53:30 PST 2024


================
@@ -156,7 +158,10 @@ static bool populateDependencyMatrix(CharMatrix &DepMatrix, unsigned Level,
           Dep.push_back('I');
         }
 
-        DepMatrix.push_back(Dep);
+        // Make sure we only add unique entries to the dependency matrix.
+        if (Seen.insert(std::string(Dep.begin(), Dep.end())).second) 
----------------
nikic wrote:

```suggestion
        if (Seen.insert(StringRef(Dep.data(), Dep.size())).second) 
```
Doesn't something like this work?

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


More information about the llvm-commits mailing list