From 7447e0e0e96c976062596a4470e733d1146d506c Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Wed, 26 Feb 2025 07:43:26 -0800 Subject: [PATCH 1/2] [SelectionDAG] Avoid repeated hash lookups (NFC) --- llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp b/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp index 33c6341744478..95d0c39b84aba 100644 --- a/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp @@ -343,9 +343,10 @@ void FunctionLoweringInfo::set(const Function &fn, MachineFunction &mf, for (auto &KV : EHInfo.UnwindDestToSrcs) { const auto *Dest = cast(KV.first); MachineBasicBlock *DestMBB = getMBB(Dest); - UnwindDestToSrcs[DestMBB] = SmallPtrSet(); + auto &Srcs = UnwindDestToSrcs[DestMBB]; + Srcs = SmallPtrSet(); for (const auto P : KV.second) - UnwindDestToSrcs[DestMBB].insert(getMBB(cast(P))); + Srcs.insert(getMBB(cast(P))); } EHInfo.UnwindDestToSrcs = std::move(UnwindDestToSrcs); } From dccb94f1432fdbd79e37d1014169487aae2a06d4 Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Wed, 26 Feb 2025 21:32:16 -0800 Subject: [PATCH 2/2] Address a comment. --- llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp b/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp index 95d0c39b84aba..8bc288f1d29fc 100644 --- a/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp @@ -344,7 +344,6 @@ void FunctionLoweringInfo::set(const Function &fn, MachineFunction &mf, const auto *Dest = cast(KV.first); MachineBasicBlock *DestMBB = getMBB(Dest); auto &Srcs = UnwindDestToSrcs[DestMBB]; - Srcs = SmallPtrSet(); for (const auto P : KV.second) Srcs.insert(getMBB(cast(P))); }