diff options
author | Philip Reames <listmail@philipreames.com> | 2021-11-15 11:13:27 -0800 |
---|---|---|
committer | Philip Reames <listmail@philipreames.com> | 2021-11-15 11:13:27 -0800 |
commit | e99902a8723e400322c3e1f32f3667c7cda83dae (patch) | |
tree | b1687129fe38d2548d4421e36d05849aa403e460 /llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp | |
parent | 224e46d355bb1e6219706f1be41287fbd9fb737d (diff) | |
download | llvm-e99902a8723e400322c3e1f32f3667c7cda83dae.zip llvm-e99902a8723e400322c3e1f32f3667c7cda83dae.tar.gz llvm-e99902a8723e400322c3e1f32f3667c7cda83dae.tar.bz2 |
[runtime-unroll] Restructure if-clause to improve readability [NFC]
Diffstat (limited to 'llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp b/llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp index 0cde2bc..34d87bb 100644 --- a/llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp +++ b/llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp @@ -635,19 +635,21 @@ bool llvm::UnrollRuntimeLoopRemainder( // These are exit blocks other than the target of the latch exiting block. SmallVector<BasicBlock *, 4> OtherExits; L->getUniqueNonLatchExitBlocks(OtherExits); - bool isMultiExitUnrollingEnabled = - canSafelyUnrollMultiExitLoop(L, LatchExit, PreserveLCSSA, - UseEpilogRemainder) && - canProfitablyUnrollMultiExitLoop(L, OtherExits, LatchExit, PreserveLCSSA, - UseEpilogRemainder); - // Support only single exit and exiting block unless multi-exit loop unrolling is enabled. - if (!isMultiExitUnrollingEnabled && - (!L->getExitingBlock() || OtherExits.size())) { - LLVM_DEBUG( - dbgs() - << "Multiple exit/exiting blocks in loop and multi-exit unrolling not " - "enabled!\n"); - return false; + // 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)) + return false; + + if (!canProfitablyUnrollMultiExitLoop(L, OtherExits, LatchExit, + PreserveLCSSA, UseEpilogRemainder)) { + LLVM_DEBUG( + dbgs() + << "Multiple exit/exiting blocks in loop and multi-exit unrolling not " + "enabled!\n"); + return false; + } } // Use Scalar Evolution to compute the trip count. This allows more loops to // be unrolled than relying on induction var simplification. |