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

Sjoerd Meijer via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 16 01:36:36 PST 2024


================
@@ -110,6 +110,7 @@ static bool populateDependencyMatrix(CharMatrix &DepMatrix, unsigned Level,
                     << " Loads and Stores to analyze\n");
 
   ValueVector::iterator I, IE, J, JE;
+  SmallDenseSet<size_t> Seen;
----------------
sjoerdmeijer wrote:

StringRef doesn't own the data. I construct a std::string in the loop from a vector of characters. My concern is that when that string goes out of scope, the std::string is deallocated, and the StringRef in the set points to invalid memory. I thought just storing an integer would be easiest. And I did a grep for "DenseSmallSet<std::string" and didn't see any precedent for that. Let me know if I got any of this wrong, am of course happy to change this.

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


More information about the llvm-commits mailing list