Skip to content

Commit 1735291

Browse files
[TableGen] Use heterogenous lookups with std::map (NFC) (#115682)
Heterogenous lookups allow us to call find with StringRef, avoiding a temporary heap allocation of std::string.
1 parent 4c4db3c commit 1735291

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

clang/utils/TableGen/NeonEmitter.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ class Intrinsic {
340340
/// The index of the key type passed to CGBuiltin.cpp for polymorphic calls.
341341
int PolymorphicKeyType;
342342
/// The local variables defined.
343-
std::map<std::string, Variable> Variables;
343+
std::map<std::string, Variable, std::less<>> Variables;
344344
/// NeededEarly - set if any other intrinsic depends on this intrinsic.
345345
bool NeededEarly;
346346
/// UseMacro - set if we should implement using a macro or unset for a
@@ -1548,8 +1548,8 @@ Intrinsic::DagEmitter::emitDagCast(const DagInit *DI, bool IsBitCast) {
15481548
// 5. The value "H" or "D" to half or double the bitwidth.
15491549
// 6. The value "8" to convert to 8-bit (signed) integer lanes.
15501550
if (!DI->getArgNameStr(ArgIdx).empty()) {
1551-
assert_with_loc(Intr.Variables.find(std::string(
1552-
DI->getArgNameStr(ArgIdx))) != Intr.Variables.end(),
1551+
assert_with_loc(Intr.Variables.find(DI->getArgNameStr(ArgIdx)) !=
1552+
Intr.Variables.end(),
15531553
"Variable not found");
15541554
castToType =
15551555
Intr.Variables[std::string(DI->getArgNameStr(ArgIdx))].getType();

0 commit comments

Comments
 (0)