File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
llvm/lib/Transforms/Vectorize Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -18519,7 +18519,8 @@ Value *BoUpSLP::vectorizeTree(
1851918519 else
1852018520 Builder.SetInsertPoint(&F->getEntryBlock(), F->getEntryBlock().begin());
1852118521
18522- // Vectorize gather operands of the nodes with the external uses only.
18522+ // Vectorize gather operands of the nodes with the external uses only.
18523+ SmallVector<std::pair<TreeEntry *, Instruction *>> GatherEntries;
1852318524 for (const std::unique_ptr<TreeEntry> &TE : VectorizableTree) {
1852418525 if (TE->isGather() && !TE->VectorizedValue && TE->UserTreeIndex.UserTE &&
1852518526 TE->UserTreeIndex.UserTE->hasState() &&
@@ -18530,11 +18531,14 @@ Value *BoUpSLP::vectorizeTree(
1853018531 [](Value *V) { return isUsedOutsideBlock(V); })) {
1853118532 Instruction &LastInst =
1853218533 getLastInstructionInBundle(TE->UserTreeIndex.UserTE);
18533- Builder.SetInsertPoint(&LastInst);
18534- Builder.SetCurrentDebugLocation(LastInst.getDebugLoc());
18535- (void)vectorizeTree(TE.get());
18534+ GatherEntries.emplace_back(TE.get(), &LastInst);
1853618535 }
1853718536 }
18537+ for (auto &Entry : GatherEntries) {
18538+ Builder.SetInsertPoint(Entry.second);
18539+ Builder.SetCurrentDebugLocation(Entry.second->getDebugLoc());
18540+ (void)vectorizeTree(Entry.first);
18541+ }
1853818542 // Emit gathered loads first to emit better code for the users of those
1853918543 // gathered loads.
1854018544 for (const std::unique_ptr<TreeEntry> &TE : VectorizableTree) {
You can’t perform that action at this time.
0 commit comments