[llvm] [SPIRV] Avoid repeated hash lookups (NFC) (PR #129358)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 28 20:12:23 PST 2025
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/129358
None
>From d6a4090d288b8aa9b78101e5a24e239b1341e78e Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Thu, 27 Feb 2025 23:09:54 -0800
Subject: [PATCH] [SPIRV] Avoid repeated hash lookups (NFC)
---
llvm/lib/Target/SPIRV/SPIRVMergeRegionExitTargets.cpp | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/llvm/lib/Target/SPIRV/SPIRVMergeRegionExitTargets.cpp b/llvm/lib/Target/SPIRV/SPIRVMergeRegionExitTargets.cpp
index c22492ec43b09..267ab7b6376bd 100644
--- a/llvm/lib/Target/SPIRV/SPIRVMergeRegionExitTargets.cpp
+++ b/llvm/lib/Target/SPIRV/SPIRVMergeRegionExitTargets.cpp
@@ -87,12 +87,8 @@ class SPIRVMergeRegionExitTargets : public FunctionPass {
BasicBlock *RHSTarget =
BI->isConditional() ? BI->getSuccessor(1) : nullptr;
- Value *LHS = TargetToValue.count(LHSTarget) != 0
- ? TargetToValue.at(LHSTarget)
- : nullptr;
- Value *RHS = TargetToValue.count(RHSTarget) != 0
- ? TargetToValue.at(RHSTarget)
- : nullptr;
+ Value *LHS = TargetToValue.lookup(LHSTarget);
+ Value *RHS = TargetToValue.lookup(RHSTarget);
if (LHS == nullptr || RHS == nullptr)
return LHS == nullptr ? RHS : LHS;
More information about the llvm-commits
mailing list