[llvm] [LV] Prefer DenseMap::lookup over find (NFC) (PR #141809)
Ramkumar Ramachandra via llvm-commits
llvm-commits at lists.llvm.org
Wed May 28 10:32:25 PDT 2025
https://github.com/artagnon created https://github.com/llvm/llvm-project/pull/141809
None
>From 5a5ebddfefd0a0885052899010a738101f44c608 Mon Sep 17 00:00:00 2001
From: Ramkumar Ramachandra <r at artagnon.com>
Date: Wed, 28 May 2025 19:30:36 +0200
Subject: [PATCH] [LV] Prefer DenseMap::lookup over find (NFC)
---
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index 05b5764ffcafc..4baa7907178c7 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -2566,9 +2566,9 @@ static Value *getExpandedStep(const InductionDescriptor &ID,
return C->getValue();
if (auto *U = dyn_cast<SCEVUnknown>(Step))
return U->getValue();
- auto I = ExpandedSCEVs.find(Step);
- assert(I != ExpandedSCEVs.end() && "SCEV must be expanded at this point");
- return I->second;
+ auto *V = ExpandedSCEVs.lookup(Step);
+ assert(V && "SCEV must be expanded at this point");
+ return V;
}
/// Knowing that loop \p L executes a single vector iteration, add instructions
@@ -10160,7 +10160,7 @@ preparePlanForEpilogueVectorLoop(VPlan &Plan, Loop *L,
if (!ExpandR)
continue;
auto *ExpandedVal =
- Plan.getOrAddLiveIn(ExpandedSCEVs.find(ExpandR->getSCEV())->second);
+ Plan.getOrAddLiveIn(ExpandedSCEVs.lookup(ExpandR->getSCEV()));
ExpandR->replaceAllUsesWith(ExpandedVal);
if (Plan.getTripCount() == ExpandR)
Plan.resetTripCount(ExpandedVal);
More information about the llvm-commits
mailing list