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(
18519
18519
else
18520
18520
Builder.SetInsertPoint(&F->getEntryBlock(), F->getEntryBlock().begin());
18521
18521
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;
18523
18524
for (const std::unique_ptr<TreeEntry> &TE : VectorizableTree) {
18524
18525
if (TE->isGather() && !TE->VectorizedValue && TE->UserTreeIndex.UserTE &&
18525
18526
TE->UserTreeIndex.UserTE->hasState() &&
@@ -18530,11 +18531,14 @@ Value *BoUpSLP::vectorizeTree(
18530
18531
[](Value *V) { return isUsedOutsideBlock(V); })) {
18531
18532
Instruction &LastInst =
18532
18533
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);
18536
18535
}
18537
18536
}
18537
+ for (auto &Entry : GatherEntries) {
18538
+ Builder.SetInsertPoint(Entry.second);
18539
+ Builder.SetCurrentDebugLocation(Entry.second->getDebugLoc());
18540
+ (void)vectorizeTree(Entry.first);
18541
+ }
18538
18542
// Emit gathered loads first to emit better code for the users of those
18539
18543
// gathered loads.
18540
18544
for (const std::unique_ptr<TreeEntry> &TE : VectorizableTree) {
You can’t perform that action at this time.
0 commit comments