Skip to content

Commit b2525dc

Browse files
[MCA] Avoid repeated hash lookups (NFC) (#129192)
1 parent 9af10e3 commit b2525dc

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

llvm/lib/MCA/InstrBuilder.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -634,16 +634,14 @@ InstrBuilder::createInstrDescImpl(const MCInst &MCI,
634634
bool IsVariadic = MCDesc.isVariadic();
635635
if ((ID->IsRecyclable = !IsVariadic && !IsVariant)) {
636636
auto DKey = std::make_pair(MCI.getOpcode(), SchedClassID);
637-
Descriptors[DKey] = std::move(ID);
638-
return *Descriptors[DKey];
637+
return *(Descriptors[DKey] = std::move(ID));
639638
}
640639

641640
auto VDKey = std::make_pair(hashMCInst(MCI), SchedClassID);
642641
assert(
643642
!VariantDescriptors.contains(VDKey) &&
644643
"Expected VariantDescriptors to not already have a value for this key.");
645-
VariantDescriptors[VDKey] = std::move(ID);
646-
return *VariantDescriptors[VDKey];
644+
return *(VariantDescriptors[VDKey] = std::move(ID));
647645
}
648646

649647
Expected<const InstrDesc &>

0 commit comments

Comments
 (0)