[llvm] [NFC] Use more efficient data structures in SubtargetEmitter (PR #102090)

Rahul Joshi via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 6 08:47:23 PDT 2024


================
@@ -260,7 +260,7 @@ unsigned SubtargetEmitter::FeatureKeyValues(
   llvm::sort(FeatureList, LessRecordFieldName());
 
   // Check that there are no duplicate keys
-  std::set<StringRef> UniqueKeys;
+  llvm::StringSet<> UniqueKeys;
----------------
jurahul wrote:

Thanks. It wasn't immediately clear, but I now see that https://llvm.org/docs/ProgrammersManual.html#llvm-adt-stringmap-h mentions that: "The string data (key) and the element object (value) are stored in the same allocation". I will change it to DenseSet, Also, I am adding an addition enhancement to track the previous definition so its easy to see where the 2 duplicate definitions are.

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


More information about the llvm-commits mailing list