[PATCH] D102615: [LoopDeletion] Break backedge if we can prove that the loop is exited on 1st iteration
Philip Reames via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon May 24 15:13:36 PDT 2021
reames accepted this revision.
reames added a comment.
This revision is now accepted and ready to land.
LGTM w/minor comments.
================
Comment at: llvm/lib/Transforms/Scalar/LoopDeletion.cpp:204
+ auto GetOnlyLivePred = [&](BasicBlock * BB)->BasicBlock * {
+ if (BB == Header)
+ return L->getLoopPredecessor();
----------------
This check should probably be lifted to caller, and assert !Header here. It confuses the interface of this lambda.
You could also consider renaming the lambda to getSolePredecessorOnFirstIteration.
================
Comment at: llvm/lib/Transforms/Scalar/LoopDeletion.cpp:210
+ // 2 live preds.
+ if (OnlyPred)
+ return nullptr;
----------------
Note that predecessors can be listed multiple times due to switches. You should check that OnlyPred is non-null and not equal to this block.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D102615/new/
https://reviews.llvm.org/D102615
More information about the llvm-commits
mailing list