Skip to content

[SLPVectorizer] Avoid two successive hash lookups on the same key #107143

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

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11804,10 +11804,9 @@ void BoUpSLP::reorderInputsAccordingToOpcode(ArrayRef<Value *> VL,
}

Instruction &BoUpSLP::getLastInstructionInBundle(const TreeEntry *E) {
auto It = EntryToLastInstruction.find(E);
if (It != EntryToLastInstruction.end())
return *It->second;
auto &Res = EntryToLastInstruction.try_emplace(E).first->second;
if (Res)
return *Res;
// Get the basic block this bundle is in. All instructions in the bundle
// should be in this block (except for extractelement-like instructions with
// constant indeces).
Expand Down
Loading