Skip to content

Commit 7fb8285

Browse files
[PowerPC] Avoid repeated hash lookups (NFC) (llvm#125634)
1 parent 1fba186 commit 7fb8285

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

llvm/lib/Target/PowerPC/PPCRegisterInfo.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,10 @@ class PPCRegisterInfo : public PPCGenRegisterInfo {
6565
/// for a given imm form load/store opcode \p ImmFormOpcode.
6666
/// FIXME: move this to PPCInstrInfo class.
6767
unsigned getMappedIdxOpcForImmOpc(unsigned ImmOpcode) const {
68-
if (!ImmToIdxMap.count(ImmOpcode))
68+
auto It = ImmToIdxMap.find(ImmOpcode);
69+
if (It == ImmToIdxMap.end())
6970
return PPC::INSTRUCTION_LIST_END;
70-
return ImmToIdxMap.find(ImmOpcode)->second;
71+
return It->second;
7172
}
7273

7374
/// getPointerRegClass - Return the register class to use to hold pointers.

0 commit comments

Comments
 (0)