[llvm] [SPIRV] Avoid repeated hash lookups (NFC) (PR #129358)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 28 20:12:53 PST 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-spir-v
Author: Kazu Hirata (kazutakahirata)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/129358.diff
1 Files Affected:
- (modified) llvm/lib/Target/SPIRV/SPIRVMergeRegionExitTargets.cpp (+2-6)
``````````diff
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;
``````````
</details>
https://github.com/llvm/llvm-project/pull/129358
More information about the llvm-commits
mailing list