Skip to content

Commit 46a2f41

Browse files
committed
Revert "[LV] Don't add blocks to loop in GeneratedRTChecks (NFC)."
This reverts commit 2fd6f8f. This missed a possible case, causing buildbot failures.
1 parent 0c84d71 commit 46a2f41

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2082,6 +2082,9 @@ class GeneratedRTChecks {
20822082

20832083
auto *Pred = LoopVectorPreHeader->getSinglePredecessor();
20842084
BranchInst::Create(LoopVectorPreHeader, SCEVCheckBlock);
2085+
// Create new preheader for vector loop.
2086+
if (OuterLoop)
2087+
OuterLoop->addBasicBlockToLoop(SCEVCheckBlock, *LI);
20852088

20862089
SCEVCheckBlock->getTerminator()->eraseFromParent();
20872090
SCEVCheckBlock->moveBefore(LoopVectorPreHeader);
@@ -2119,6 +2122,9 @@ class GeneratedRTChecks {
21192122
DT->changeImmediateDominator(LoopVectorPreHeader, MemCheckBlock);
21202123
MemCheckBlock->moveBefore(LoopVectorPreHeader);
21212124

2125+
if (OuterLoop)
2126+
OuterLoop->addBasicBlockToLoop(MemCheckBlock, *LI);
2127+
21222128
BranchInst &BI =
21232129
*BranchInst::Create(Bypass, LoopVectorPreHeader, MemRuntimeCheckCond);
21242130
if (AddBranchWeights) {

0 commit comments

Comments
 (0)