Skip to content

Commit b06aea0

Browse files
committed
Layout loop unrolled blocks next to the original loop.
1 parent 7c2c047 commit b06aea0

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/SILOptimizer/LoopTransforms/LoopUnroll.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ void LoopCloner::cloneLoop() {
7474
Loop->getExitBlocks(ExitBlocks);
7575

7676
// Clone the entire loop.
77-
cloneReachableBlocks(Loop->getHeader(), ExitBlocks);
77+
cloneReachableBlocks(Loop->getHeader(), ExitBlocks,
78+
/*insertAfter*/Loop->getLoopLatch());
7879
}
7980

8081
/// Determine the number of iterations the loop is at most executed. The loop
@@ -93,7 +94,7 @@ static Optional<uint64_t> getMaxLoopTripCount(SILLoop *Loop,
9394
if (!Loop->isLoopExiting(Latch))
9495
return None;
9596

96-
// Get the loop exit condition.
97+
// Get the loop exit condition.
9798
auto *CondBr = dyn_cast<CondBranchInst>(Latch->getTerminator());
9899
if (!CondBr)
99100
return None;

0 commit comments

Comments
 (0)