Skip to content

Commit 6ec113d

Browse files
[Local] Avoid repeated map lookups (NFC) (#113072)
1 parent f13d3f7 commit 6ec113d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

llvm/lib/Transforms/Utils/Local.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3840,11 +3840,11 @@ static const std::optional<BitPart> &
38403840
collectBitParts(Value *V, bool MatchBSwaps, bool MatchBitReversals,
38413841
std::map<Value *, std::optional<BitPart>> &BPS, int Depth,
38423842
bool &FoundRoot) {
3843-
auto I = BPS.find(V);
3844-
if (I != BPS.end())
3843+
auto [I, Inserted] = BPS.try_emplace(V);
3844+
if (!Inserted)
38453845
return I->second;
38463846

3847-
auto &Result = BPS[V] = std::nullopt;
3847+
auto &Result = I->second;
38483848
auto BitWidth = V->getType()->getScalarSizeInBits();
38493849

38503850
// Can't do integer/elements > 128 bits.

0 commit comments

Comments
 (0)