-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[Vectorize] Avoid repeated hash lookups (NFC) #132661
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Vectorize] Avoid repeated hash lookups (NFC) #132661
Conversation
@llvm/pr-subscribers-llvm-transforms @llvm/pr-subscribers-vectorizers Author: Kazu Hirata (kazutakahirata) ChangesFull diff: https://github.com/llvm/llvm-project/pull/132661.diff 1 Files Affected:
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index 92160a421e59c..ae55049c22338 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -5815,12 +5815,13 @@ LoopVectorizationCostModel::getReductionPatternCost(Instruction *I,
// Test if the found instruction is a reduction, and if not return an invalid
// cost specifying the parent to use the original cost modelling.
- if (!InLoopReductionImmediateChains.count(RetI))
+ auto RetIIt = InLoopReductionImmediateChains.find(RetI);
+ if (RetIIt == InLoopReductionImmediateChains.end())
return std::nullopt;
// Find the reduction this chain is a part of and calculate the basic cost of
// the reduction on its own.
- Instruction *LastChain = InLoopReductionImmediateChains.at(RetI);
+ Instruction *LastChain = RetIIt->second;
Instruction *ReductionPhi = LastChain;
while (!isa<PHINode>(ReductionPhi))
ReductionPhi = InLoopReductionImmediateChains.at(ReductionPhi);
|
Co-authored-by: Florian Hahn <[email protected]>
Co-authored-by: Florian Hahn <[email protected]>
@fhahn Please take another look. Thanks! |
✅ With the latest revision this PR passed the C/C++ code formatter. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks
No description provided.