Skip to content

Commit 8f95e91

Browse files
committed
[unroll-runtime] Relax two profitability limitations on multi-exit unrolling
This change is mostly about getting rid of some "uninteresting" cases in a follow on deeper heuristic change. If anyone sees actually interesting code differences out of this, please let me know. I'm not expecting this to have much impact at all. Case 1 - With the single deoptimize non-latch exit, we can't have two exiting blocks sharing an exit block. We can only hit this with a poorly documented debug flag. Case 2 - Why should we treat epilog cases differently from prolog cases? Or to say it differently, why should starting with a constant control whether a multiple exit loop gets unrolled? Sorry for the lack of tests here. These are both *exceedingly* narrow cases in practice, and after a while trying, I couldn't come up with a test which did anything "useful" as opposed to simply exercise a random combination of force flags. Note that the legality cases for each are already exercised with force flags.
1 parent bee8e20 commit 8f95e91

File tree

1 file changed

+0
-10
lines changed

1 file changed

+0
-10
lines changed

llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -421,16 +421,6 @@ static bool canProfitablyUnrollMultiExitLoop(
421421
if (UnrollRuntimeMultiExit.getNumOccurrences())
422422
return UnrollRuntimeMultiExit;
423423

424-
// TODO: We used to bail out for correctness (now fixed). Under what
425-
// circumstances is this case profitable to allow?
426-
if (!LatchExit->getSinglePredecessor())
427-
return false;
428-
429-
// TODO: We used to bail out for correctness (now fixed). Under what
430-
// circumstances is this case profitable to allow?
431-
if (UseEpilogRemainder && L->getParentLoop())
432-
return false;
433-
434424
// The main pain point with multi-exit loop unrolling is that once unrolled,
435425
// we will not be able to merge all blocks into a straight line code.
436426
// There are branches within the unrolled loop that go to the OtherExits.

0 commit comments

Comments
 (0)