From cfac2c48f82bb146d13c8d66da20b46161883fe6 Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Fri, 7 Mar 2025 01:05:35 -0800 Subject: [PATCH] [X86] Avoid repeated hash lookups (NFC) --- llvm/lib/Target/X86/X86PreTileConfig.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/llvm/lib/Target/X86/X86PreTileConfig.cpp b/llvm/lib/Target/X86/X86PreTileConfig.cpp index e8d90da1fb1e0..f2ec4369a5ca4 100644 --- a/llvm/lib/Target/X86/X86PreTileConfig.cpp +++ b/llvm/lib/Target/X86/X86PreTileConfig.cpp @@ -400,8 +400,9 @@ bool X86PreTileConfig::runOnMachineFunction(MachineFunction &MF) { // A given point might be forked due to shape conditions are not met. for (MIRef I : InsertPoints) { // Make sure we insert ldtilecfg after the last shape def in MBB. - if (ShapeBBs.count(I.MBB) && I < ShapeBBs[I.MBB].back()) - I = ShapeBBs[I.MBB].back(); + auto It = ShapeBBs.find(I.MBB); + if (It != ShapeBBs.end() && I < It->second.back()) + I = It->second.back(); // There're chances the MBB is sunk more than once. Record it to avoid // multi insert. if (VisitedOrInserted.insert(I).second) {