Skip to content

Commit 50064db

Browse files
[AMDGPU] Avoid repeated hash lookups (NFC) (llvm#129189)
1 parent 97da085 commit 50064db

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

llvm/lib/Target/AMDGPU/AMDGPURegBankLegalizeRules.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -314,18 +314,20 @@ RegBankLegalizeRules::getRulesForOpc(MachineInstr &MI) const {
314314
Opc == AMDGPU::G_INTRINSIC_W_SIDE_EFFECTS ||
315315
Opc == AMDGPU::G_INTRINSIC_CONVERGENT_W_SIDE_EFFECTS) {
316316
unsigned IntrID = cast<GIntrinsic>(MI).getIntrinsicID();
317-
if (!IRulesAlias.contains(IntrID)) {
317+
auto IRAIt = IRulesAlias.find(IntrID);
318+
if (IRAIt == IRulesAlias.end()) {
318319
LLVM_DEBUG(dbgs() << "MI: "; MI.dump(););
319320
llvm_unreachable("No rules defined for intrinsic opcode");
320321
}
321-
return IRules.at(IRulesAlias.at(IntrID));
322+
return IRules.at(IRAIt->second);
322323
}
323324

324-
if (!GRulesAlias.contains(Opc)) {
325+
auto GRAIt = GRulesAlias.find(Opc);
326+
if (GRAIt == GRulesAlias.end()) {
325327
LLVM_DEBUG(dbgs() << "MI: "; MI.dump(););
326328
llvm_unreachable("No rules defined for generic opcode");
327329
}
328-
return GRules.at(GRulesAlias.at(Opc));
330+
return GRules.at(GRAIt->second);
329331
}
330332

331333
// Syntactic sugar wrapper for predicate lambda that enables '&&', '||' and '!'.

0 commit comments

Comments
 (0)