@@ -11804,9 +11804,10 @@ void BoUpSLP::reorderInputsAccordingToOpcode(ArrayRef<Value *> VL,
11804
11804
}
11805
11805
11806
11806
Instruction &BoUpSLP::getLastInstructionInBundle(const TreeEntry *E) {
11807
- auto &Res = EntryToLastInstruction.FindAndConstruct(E);
11808
- if (Res.second)
11809
- return *Res.second;
11807
+ auto It = EntryToLastInstruction.find(E);
11808
+ if (It != EntryToLastInstruction.end())
11809
+ return *It->second;
11810
+ auto &Res = EntryToLastInstruction.try_emplace(E).first->second;
11810
11811
// Get the basic block this bundle is in. All instructions in the bundle
11811
11812
// should be in this block (except for extractelement-like instructions with
11812
11813
// constant indeces).
@@ -11910,10 +11911,10 @@ Instruction &BoUpSLP::getLastInstructionInBundle(const TreeEntry *E) {
11910
11911
return isa<ExtractElementInst, UndefValue>(V) ||
11911
11912
areAllOperandsNonInsts(V);
11912
11913
})))
11913
- Res.second = FindLastInst();
11914
+ Res = FindLastInst();
11914
11915
else
11915
- Res.second = FindFirstInst();
11916
- return *Res.second ;
11916
+ Res = FindFirstInst();
11917
+ return *Res;
11917
11918
}
11918
11919
11919
11920
// Find the last instruction. The common case should be that BB has been
@@ -11927,7 +11928,7 @@ Instruction &BoUpSLP::getLastInstructionInBundle(const TreeEntry *E) {
11927
11928
auto *Bundle = BlocksSchedules[BB]->getScheduleData(V);
11928
11929
if (Bundle && Bundle->isPartOfBundle())
11929
11930
for (; Bundle; Bundle = Bundle->NextInBundle)
11930
- Res.second = Bundle->Inst;
11931
+ Res = Bundle->Inst;
11931
11932
}
11932
11933
11933
11934
// LastInst can still be null at this point if there's either not an entry
@@ -11948,10 +11949,10 @@ Instruction &BoUpSLP::getLastInstructionInBundle(const TreeEntry *E) {
11948
11949
// not ideal. However, this should be exceedingly rare since it requires that
11949
11950
// we both exit early from buildTree_rec and that the bundle be out-of-order
11950
11951
// (causing us to iterate all the way to the end of the block).
11951
- if (!Res.second )
11952
- Res.second = FindLastInst();
11953
- assert(Res.second && "Failed to find last instruction in bundle");
11954
- return *Res.second ;
11952
+ if (!Res)
11953
+ Res = FindLastInst();
11954
+ assert(Res && "Failed to find last instruction in bundle");
11955
+ return *Res;
11955
11956
}
11956
11957
11957
11958
void BoUpSLP::setInsertPointAfterBundle(const TreeEntry *E) {
0 commit comments