[PATCH] D44919: [LoopUnroll][NFC] Remove redundant canPeel check
Max Kazantsev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 27 00:24:34 PDT 2018
mkazantsev created this revision.
mkazantsev added reviewers: fhahn, samparker, iajbar, a.elovikov.
We check `canPeel` twice: when evaluating the number of iterations to be peeled
and within the method `peelLoop` that performs peeling. This method is only
executed if the calculated peel count is positive. Thus, the check in `peelLoop` can
never fail. This patch replaces this check with an assert.
https://reviews.llvm.org/D44919
Files:
lib/Transforms/Utils/LoopUnrollPeel.cpp
Index: lib/Transforms/Utils/LoopUnrollPeel.cpp
===================================================================
--- lib/Transforms/Utils/LoopUnrollPeel.cpp
+++ lib/Transforms/Utils/LoopUnrollPeel.cpp
@@ -473,8 +473,8 @@
bool llvm::peelLoop(Loop *L, unsigned PeelCount, LoopInfo *LI,
ScalarEvolution *SE, DominatorTree *DT,
AssumptionCache *AC, bool PreserveLCSSA) {
- if (!canPeel(L))
- return false;
+ assert(PeelCount > 0 && "Attempt to peel out zero iterations?");
+ assert(canPeel(L) && "Attempt to peel a loop which is not peelable?");
LoopBlocksDFS LoopBlocks(L);
LoopBlocks.perform(LI);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44919.139891.patch
Type: text/x-patch
Size: 654 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180327/81e6c301/attachment.bin>
More information about the llvm-commits
mailing list