Skip to content

Commit 7350978

Browse files
[X86] Avoid repeated hash lookups (NFC) (#126857)
1 parent a282b6c commit 7350978

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

llvm/lib/Target/X86/X86DomainReassignment.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -451,8 +451,8 @@ bool X86DomainReassignment::visitRegister(Closure &C, Register Reg,
451451
}
452452

453453
bool X86DomainReassignment::encloseInstr(Closure &C, MachineInstr *MI) {
454-
auto I = EnclosedInstrs.find(MI);
455-
if (I != EnclosedInstrs.end()) {
454+
auto [I, Inserted] = EnclosedInstrs.try_emplace(MI, C.getID());
455+
if (!Inserted) {
456456
if (I->second != C.getID()) {
457457
// Instruction already belongs to another closure, avoid conflicts between
458458
// closure and mark this closure as illegal.
@@ -462,7 +462,6 @@ bool X86DomainReassignment::encloseInstr(Closure &C, MachineInstr *MI) {
462462
return true;
463463
}
464464

465-
EnclosedInstrs[MI] = C.getID();
466465
C.addInstruction(MI);
467466

468467
// Mark closure as illegal for reassignment to domains, if there is no

0 commit comments

Comments
 (0)