Skip to content

Commit 6f5ca9b

Browse files
[ARM] Avoid repeated map lookups (NFC) (#127168)
1 parent 1bc2f1c commit 6f5ca9b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

llvm/lib/Target/ARM/ARMParallelDSP.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,8 @@ bool ARMParallelDSP::AreSequentialLoads(LoadInst *Ld0, LoadInst *Ld1,
300300
if (!Ld0 || !Ld1)
301301
return false;
302302

303-
if (!LoadPairs.count(Ld0) || LoadPairs[Ld0] != Ld1)
303+
auto It = LoadPairs.find(Ld0);
304+
if (It == LoadPairs.end() || It->second != Ld1)
304305
return false;
305306

306307
LLVM_DEBUG(dbgs() << "Loads are sequential and valid:\n";
@@ -382,8 +383,8 @@ bool ARMParallelDSP::RecordMemoryOps(BasicBlock *BB) {
382383
LoadInst *Dominator = BaseFirst ? Base : Offset;
383384
LoadInst *Dominated = BaseFirst ? Offset : Base;
384385

385-
if (RAWDeps.count(Dominated)) {
386-
InstSet &WritesBefore = RAWDeps[Dominated];
386+
if (auto It = RAWDeps.find(Dominated); It != RAWDeps.end()) {
387+
InstSet &WritesBefore = It->second;
387388

388389
for (auto *Before : WritesBefore) {
389390
// We can't move the second load backward, past a write, to merge

0 commit comments

Comments
 (0)