[PATCH] D120364: [SLP] Simplify extendSchedulingRegion
Philip Reames via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 23 08:51:20 PST 2022
reames updated this revision to Diff 410835.
reames retitled this revision from "[SLP] Simplify extendSchedulingRegion and fix a bug in region cap handling" to "[SLP] Simplify extendSchedulingRegion".
reames edited the summary of this revision.
reames added a comment.
Rebase and simplify patch after removing cap mechanism entirely. Remaining review should be quick provided I'd not missing some algorithmic detail.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D120364/new/
https://reviews.llvm.org/D120364
Files:
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
Index: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
===================================================================
--- llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -7635,21 +7635,8 @@
LLVM_DEBUG(dbgs() << "SLP: initialize schedule region to " << *I << "\n");
return;
}
- // Search up and down at the same time, because we don't know if the new
- // instruction is above or below the existing scheduling region.
- BasicBlock::reverse_iterator UpIter =
- ++ScheduleStart->getIterator().getReverse();
- BasicBlock::reverse_iterator UpperEnd = BB->rend();
- BasicBlock::iterator DownIter = ScheduleEnd->getIterator();
- BasicBlock::iterator LowerEnd = BB->end();
- while (UpIter != UpperEnd && DownIter != LowerEnd && &*UpIter != I &&
- &*DownIter != I) {
- ++UpIter;
- ++DownIter;
- }
- if (DownIter == LowerEnd || (UpIter != UpperEnd && &*UpIter == I)) {
- assert(I->getParent() == ScheduleStart->getParent() &&
- "Instruction is in wrong basic block.");
+
+ if (I->comesBefore(ScheduleStart)) {
initScheduleData(I, ScheduleStart, nullptr, FirstLoadStoreInRegion);
ScheduleStart = I;
if (isOneOf(S, I) != I)
@@ -7658,17 +7645,14 @@
<< "\n");
return;
}
- assert((UpIter == UpperEnd || (DownIter != LowerEnd && &*DownIter == I)) &&
- "Expected to reach top of the basic block or instruction down the "
- "lower end.");
- assert(I->getParent() == ScheduleEnd->getParent() &&
- "Instruction is in wrong basic block.");
- initScheduleData(ScheduleEnd, I->getNextNode(), LastLoadStoreInRegion,
- nullptr);
- ScheduleEnd = I->getNextNode();
+
+ auto *NextI = I->getNextNode();
+ assert(NextI && "tried to vectorize a terminator?");
+ assert(ScheduleEnd->comesBefore(NextI) && "must extend?");
+ initScheduleData(ScheduleEnd, NextI, LastLoadStoreInRegion, nullptr);
+ ScheduleEnd = NextI;
if (isOneOf(S, I) != I)
CheckSheduleForI(I);
- assert(ScheduleEnd && "tried to vectorize a terminator?");
LLVM_DEBUG(dbgs() << "SLP: extend schedule region end to " << *I << "\n");
return;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D120364.410835.patch
Type: text/x-patch
Size: 2206 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220223/69ed91e6/attachment.bin>
More information about the llvm-commits
mailing list