[PATCH] D44667: [LoopPredication] Add profitability check based on BPI
Serguei Katkov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 21 00:29:28 PDT 2018
skatkov added inline comments.
================
Comment at: lib/Transforms/Scalar/LoopPredication.cpp:722
+ return true;
+ SmallVector<BasicBlock *, 4> ExitingBlocks;
+ L->getExitingBlocks(ExitingBlocks);
----------------
skatkov wrote:
> BasicBlock has an utility function getExitEdges.
> I propose to use it instead of iteration over ExitingLoops.
> This way, your loop will be simplified a lot I guess.
>
> I would also consider inserting an assert that latch is an exiting block.
> By definition latch should not require to be an exiting block. But the logic below expects it as I understand...
> As I understand the latch is an exiting block due to it is a loop pass and loop is in canonical form. So it is ok but I would still consider inserting an assert... Or alternatively I would find an edge from latch to exit block in an array returned from getExitEdges (this will imply an assert and gives you an input to get probability).
I'm sorry, not a BasicBlock but Loop of course.
Repository:
rL LLVM
https://reviews.llvm.org/D44667
More information about the llvm-commits
mailing list