[llvm] [X86] Avoid repeated hash lookups (NFC) (PR #126857)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 11 21:06:11 PST 2025
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/126857
None
>From 593ac9c63bdc696306a7cfccc444de9e0d36e18a Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Tue, 11 Feb 2025 09:16:27 -0800
Subject: [PATCH] [X86] Avoid repeated hash lookups (NFC)
---
llvm/lib/Target/X86/X86DomainReassignment.cpp | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
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