Skip to content

Commit ccc066e

Browse files
[TableGen] Avoid repeated map lookups (NFC) (#124448)
This patch avoids repeated map lookups and constructions of temporary std::string instances by switching to DenseSet.
1 parent e8e75e0 commit ccc066e

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

clang/utils/TableGen/MveEmitter.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1955,18 +1955,17 @@ void MveEmitter::EmitBuiltinDef(raw_ostream &OS) {
19551955
<< ", \"\", \"n\")\n";
19561956
}
19571957

1958-
std::set<std::string> ShortNamesSeen;
1958+
DenseSet<StringRef> ShortNamesSeen;
19591959

19601960
for (const auto &kv : ACLEIntrinsics) {
19611961
const ACLEIntrinsic &Int = *kv.second;
19621962
if (Int.polymorphic()) {
19631963
StringRef Name = Int.shortName();
1964-
if (ShortNamesSeen.find(std::string(Name)) == ShortNamesSeen.end()) {
1964+
if (ShortNamesSeen.insert(Name).second) {
19651965
OS << "BUILTIN(__builtin_arm_mve_" << Name << ", \"vi.\", \"nt";
19661966
if (Int.nonEvaluating())
19671967
OS << "u"; // indicate that this builtin doesn't evaluate its args
19681968
OS << "\")\n";
1969-
ShortNamesSeen.insert(std::string(Name));
19701969
}
19711970
}
19721971
}

0 commit comments

Comments
 (0)