[PATCH] D121925: [LoopSimplifyCFG] Check predecessors of exits before marking them dead.

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 17 13:49:17 PDT 2022


nikic accepted this revision.
nikic added a comment.
This revision is now accepted and ready to land.

LGTM

> Alternatively we could try to require all loop passes to maintain canonical form. That in turn would also require additional verification.

I think that may be worthwhile to do longer term. I think we have some transforms that bail out if we're not in loop simplify form, so this would ensure that things compose as intended. Also, I suspect that preserving loop simplify form might make preservation simpler overall, for example it should be easier to preserve LCSSA form (don't need to deal with an exit also being a sibling loop header etc).

IIRC the legacy pass manager did not automatically convert to loop simplify form for loop pass managers, which is where the current behavior might be coming from.



================
Comment at: llvm/test/Transforms/LoopSimplifyCFG/loop-not-in-simplify-form.ll:7
 ; (i.e. it is not in loop-simplify/canonical form).
 ; FIXME: currently %res gets incorrectly replaced with undef.
 define i32 @test(i32 %v, i1 %c.1, i1 %c.2) {
----------------
Remove fixme.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D121925



More information about the llvm-commits mailing list