[PATCH] D93906: [LoopDeletion] Break backedge of loops when known not taken

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 4 09:32:57 PST 2021


nikic added a comment.

In D93906#2476763 <https://reviews.llvm.org/D93906#2476763>, @reames wrote:

> In D93906#2476680 <https://reviews.llvm.org/D93906#2476680>, @nikic wrote:
>
>> Isn't this already covered by the zero exit count optimization in IndVars?
>
> No.  I believe you're referring to optimizeLoopExits.  That does not modify the CFG, it just folds conditions to constants.  This will specifically modify the CFG and remove the loop.

Yes, that's the transform I had in mind. I see the difference now, but I'm not sure I understand the larger picture / motivation behind this. The true/false branches will get folded away by SimplifyCFG -- so is this a phase ordering problem where SimplifyCFG runs too late (if so, can we add a PhaseOrdering test)? Should we also try to fold away (to unreachable) dead exits, rather than just dead backedges?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93906/new/

https://reviews.llvm.org/D93906



More information about the llvm-commits mailing list