diff options
author | Philip Reames <listmail@philipreames.com> | 2021-11-15 11:38:06 -0800 |
---|---|---|
committer | Philip Reames <listmail@philipreames.com> | 2021-11-15 11:39:07 -0800 |
commit | 423da618354aa31ebc80681ad9ad71ddf6b0fcfd (patch) | |
tree | 1ff41917f1a164bb01b027d07c521f1dda918961 /llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp | |
parent | 0c501db7d3c2b924ca8e68c981df10716ef59f6d (diff) | |
download | llvm-423da618354aa31ebc80681ad9ad71ddf6b0fcfd.zip llvm-423da618354aa31ebc80681ad9ad71ddf6b0fcfd.tar.gz llvm-423da618354aa31ebc80681ad9ad71ddf6b0fcfd.tar.bz2 |
[runtime-unroll] Inline canSafelyUnrollMultiExitLoop [NFC]
All of the interesting logic from this routine has been removed, inline the single check into the sole non-assert caller. The assert use has little value with the restructured code and is simply dropped.
Diffstat (limited to 'llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp | 33 |
1 files changed, 5 insertions, 28 deletions
diff --git a/llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp b/llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp index 34d87bb..aca25be 100644 --- a/llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp +++ b/llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp @@ -411,35 +411,11 @@ CloneLoopBlocks(Loop *L, Value *NewIter, const bool UseEpilogRemainder, return NewLoop; } -/// Returns true if we can safely unroll a multi-exit/exiting loop. OtherExits -/// is populated with all the loop exit blocks other than the LatchExit block. -static bool canSafelyUnrollMultiExitLoop(Loop *L, BasicBlock *LatchExit, - bool PreserveLCSSA, - bool UseEpilogRemainder) { - - // We currently have some correctness constrains in unrolling a multi-exit - // loop. Check for these below. - - // We rely on LCSSA form being preserved when the exit blocks are transformed. - // (Note that only an off-by-default mode of the old PM disables PreserveLCCA.) - if (!PreserveLCSSA) - return false; - - // All constraints have been satisfied. - return true; -} - /// Returns true if we can profitably unroll the multi-exit loop L. Currently, /// we return true only if UnrollRuntimeMultiExit is set to true. static bool canProfitablyUnrollMultiExitLoop( Loop *L, SmallVectorImpl<BasicBlock *> &OtherExits, BasicBlock *LatchExit, - bool PreserveLCSSA, bool UseEpilogRemainder) { - -#if !defined(NDEBUG) - assert(canSafelyUnrollMultiExitLoop(L, LatchExit, PreserveLCSSA, - UseEpilogRemainder) && - "Should be safe to unroll before checking profitability!"); -#endif + bool UseEpilogRemainder) { // Priority goes to UnrollRuntimeMultiExit if it's supplied. if (UnrollRuntimeMultiExit.getNumOccurrences()) @@ -638,12 +614,13 @@ bool llvm::UnrollRuntimeLoopRemainder( // Support only single exit and exiting block unless multi-exit loop // unrolling is enabled. if (!L->getExitingBlock() || OtherExits.size()) { - if (!canSafelyUnrollMultiExitLoop(L, LatchExit, PreserveLCSSA, - UseEpilogRemainder)) + // We rely on LCSSA form being preserved when the exit blocks are transformed. + // (Note that only an off-by-default mode of the old PM disables PreserveLCCA.) + if (!PreserveLCSSA) return false; if (!canProfitablyUnrollMultiExitLoop(L, OtherExits, LatchExit, - PreserveLCSSA, UseEpilogRemainder)) { + UseEpilogRemainder)) { LLVM_DEBUG( dbgs() << "Multiple exit/exiting blocks in loop and multi-exit unrolling not " |