Skip to content

Commit e879213

Browse files
[Vectorize] Avoid repeated hash lookups (NFC) (#132661)
Co-authored-by: Florian Hahn <[email protected]>
1 parent 03817f0 commit e879213

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5813,12 +5813,12 @@ LoopVectorizationCostModel::getReductionPatternCost(Instruction *I,
58135813

58145814
// Test if the found instruction is a reduction, and if not return an invalid
58155815
// cost specifying the parent to use the original cost modelling.
5816-
if (!InLoopReductionImmediateChains.count(RetI))
5816+
Instruction *LastChain = InLoopReductionImmediateChains.lookup(RetI);
5817+
if (!LastChain)
58175818
return std::nullopt;
58185819

58195820
// Find the reduction this chain is a part of and calculate the basic cost of
58205821
// the reduction on its own.
5821-
Instruction *LastChain = InLoopReductionImmediateChains.at(RetI);
58225822
Instruction *ReductionPhi = LastChain;
58235823
while (!isa<PHINode>(ReductionPhi))
58245824
ReductionPhi = InLoopReductionImmediateChains.at(ReductionPhi);

0 commit comments

Comments
 (0)