[llvm] 7350978 - [X86] Avoid repeated hash lookups (NFC) (#126857)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 12 07:38:05 PST 2025
Author: Kazu Hirata
Date: 2025-02-12T23:38:01+08:00
New Revision: 73509781b52486cdff8dc68c4c143ffa2f95356e
URL: https://github.com/llvm/llvm-project/commit/73509781b52486cdff8dc68c4c143ffa2f95356e
DIFF: https://github.com/llvm/llvm-project/commit/73509781b52486cdff8dc68c4c143ffa2f95356e.diff
LOG: [X86] Avoid repeated hash lookups (NFC) (#126857)
Added:
Modified:
llvm/lib/Target/X86/X86DomainReassignment.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/X86/X86DomainReassignment.cpp b/llvm/lib/Target/X86/X86DomainReassignment.cpp
index a3547f802976b..25f81834bfa5e 100644
--- a/llvm/lib/Target/X86/X86DomainReassignment.cpp
+++ b/llvm/lib/Target/X86/X86DomainReassignment.cpp
@@ -451,8 +451,8 @@ bool X86DomainReassignment::visitRegister(Closure &C, Register Reg,
}
bool X86DomainReassignment::encloseInstr(Closure &C, MachineInstr *MI) {
- auto I = EnclosedInstrs.find(MI);
- if (I != EnclosedInstrs.end()) {
+ auto [I, Inserted] = EnclosedInstrs.try_emplace(MI, C.getID());
+ if (!Inserted) {
if (I->second != C.getID()) {
// Instruction already belongs to another closure, avoid conflicts between
// closure and mark this closure as illegal.
@@ -462,7 +462,6 @@ bool X86DomainReassignment::encloseInstr(Closure &C, MachineInstr *MI) {
return true;
}
- EnclosedInstrs[MI] = C.getID();
C.addInstruction(MI);
// Mark closure as illegal for reassignment to domains, if there is no
More information about the llvm-commits
mailing list