[llvm] [SLPVectorizer] Use DenseMap::operator[] (NFC) (PR #107123)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 3 09:29:26 PDT 2024
================
@@ -11841,9 +11841,9 @@ void BoUpSLP::reorderInputsAccordingToOpcode(ArrayRef<Value *> VL,
}
Instruction &BoUpSLP::getLastInstructionInBundle(const TreeEntry *E) {
- auto &Res = EntryToLastInstruction.FindAndConstruct(E);
- if (Res.second)
- return *Res.second;
+ auto &Res = EntryToLastInstruction[E];
----------------
kazutakahirata wrote:
`DenseMap::find` won't default-construct. Would you be OK with something like this?
```
auto It = EntryToLastInstruction.find(E);
if (It != EntryToLastInstruction.end())
return *It->second;
auto &Res = EntryToLastInstruction.insert(E).first->second;
```
https://github.com/llvm/llvm-project/pull/107123
More information about the llvm-commits
mailing list