From 52fe44aee2bafa391d23b51d6e1dc98faafb39ce Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Mon, 14 Oct 2024 21:21:44 -0700 Subject: [PATCH] [AMDGPU] Avoid repeated hash lookups (NFC) --- llvm/lib/Target/AMDGPU/SIOptimizeVGPRLiveRange.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/llvm/lib/Target/AMDGPU/SIOptimizeVGPRLiveRange.cpp b/llvm/lib/Target/AMDGPU/SIOptimizeVGPRLiveRange.cpp index 50f536c532afc..162270524263c 100644 --- a/llvm/lib/Target/AMDGPU/SIOptimizeVGPRLiveRange.cpp +++ b/llvm/lib/Target/AMDGPU/SIOptimizeVGPRLiveRange.cpp @@ -189,7 +189,7 @@ void SIOptimizeVGPRLiveRange::collectElseRegionBlocks( unsigned Cur = 0; while (MBB) { for (auto *Pred : MBB->predecessors()) { - if (Pred != Flow && !Blocks.contains(Pred)) + if (Pred != Flow) Blocks.insert(Pred); } @@ -407,10 +407,8 @@ void SIOptimizeVGPRLiveRange::updateLiveRangeInThenRegion( while (!WorkList.empty()) { auto *MBB = WorkList.pop_back_val(); for (auto *Succ : MBB->successors()) { - if (Succ != Flow && !Blocks.contains(Succ)) { + if (Succ != Flow && Blocks.insert(Succ)) WorkList.push_back(Succ); - Blocks.insert(Succ); - } } }