@@ -11804,9 +11804,10 @@ void BoUpSLP::reorderInputsAccordingToOpcode(ArrayRef<Value *> VL,
1180411804}
1180511805
1180611806Instruction &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;
1181011811 // Get the basic block this bundle is in. All instructions in the bundle
1181111812 // should be in this block (except for extractelement-like instructions with
1181211813 // constant indeces).
@@ -11910,10 +11911,10 @@ Instruction &BoUpSLP::getLastInstructionInBundle(const TreeEntry *E) {
1191011911 return isa<ExtractElementInst, UndefValue>(V) ||
1191111912 areAllOperandsNonInsts(V);
1191211913 })))
11913- Res.second = FindLastInst();
11914+ Res = FindLastInst();
1191411915 else
11915- Res.second = FindFirstInst();
11916- return *Res.second ;
11916+ Res = FindFirstInst();
11917+ return *Res;
1191711918 }
1191811919
1191911920 // Find the last instruction. The common case should be that BB has been
@@ -11927,7 +11928,7 @@ Instruction &BoUpSLP::getLastInstructionInBundle(const TreeEntry *E) {
1192711928 auto *Bundle = BlocksSchedules[BB]->getScheduleData(V);
1192811929 if (Bundle && Bundle->isPartOfBundle())
1192911930 for (; Bundle; Bundle = Bundle->NextInBundle)
11930- Res.second = Bundle->Inst;
11931+ Res = Bundle->Inst;
1193111932 }
1193211933
1193311934 // 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) {
1194811949 // not ideal. However, this should be exceedingly rare since it requires that
1194911950 // we both exit early from buildTree_rec and that the bundle be out-of-order
1195011951 // (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;
1195511956}
1195611957
1195711958void BoUpSLP::setInsertPointAfterBundle(const TreeEntry *E) {
0 commit comments