[llvm] [ARM] Avoid repeated map lookups (NFC) (PR #127168)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 13 22:09:05 PST 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-arm
Author: Kazu Hirata (kazutakahirata)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/127168.diff
1 Files Affected:
- (modified) llvm/lib/Target/ARM/ARMParallelDSP.cpp (+4-3)
``````````diff
diff --git a/llvm/lib/Target/ARM/ARMParallelDSP.cpp b/llvm/lib/Target/ARM/ARMParallelDSP.cpp
index a2b2cf1323cae..4e92720de4755 100644
--- a/llvm/lib/Target/ARM/ARMParallelDSP.cpp
+++ b/llvm/lib/Target/ARM/ARMParallelDSP.cpp
@@ -300,7 +300,8 @@ bool ARMParallelDSP::AreSequentialLoads(LoadInst *Ld0, LoadInst *Ld1,
if (!Ld0 || !Ld1)
return false;
- if (!LoadPairs.count(Ld0) || LoadPairs[Ld0] != Ld1)
+ auto It = LoadPairs.find(Ld0);
+ if (It == LoadPairs.end() || It->second != Ld1)
return false;
LLVM_DEBUG(dbgs() << "Loads are sequential and valid:\n";
@@ -382,8 +383,8 @@ bool ARMParallelDSP::RecordMemoryOps(BasicBlock *BB) {
LoadInst *Dominator = BaseFirst ? Base : Offset;
LoadInst *Dominated = BaseFirst ? Offset : Base;
- if (RAWDeps.count(Dominated)) {
- InstSet &WritesBefore = RAWDeps[Dominated];
+ if (auto It = RAWDeps.find(Dominated); It != RAWDeps.end()) {
+ InstSet &WritesBefore = It->second;
for (auto *Before : WritesBefore) {
// We can't move the second load backward, past a write, to merge
``````````
</details>
https://github.com/llvm/llvm-project/pull/127168
More information about the llvm-commits
mailing list