[all-commits] [llvm/llvm-project] 4a699a: [LoopSimplifyCFG] Check predecessors of exits befo...

Florian Hahn via All-commits all-commits at lists.llvm.org
Fri Mar 18 01:55:21 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 4a699ae9c6a6fde93ec4714d79025df58eb62a72
      https://github.com/llvm/llvm-project/commit/4a699ae9c6a6fde93ec4714d79025df58eb62a72
  Author: Florian Hahn <flo at fhahn.com>
  Date:   2022-03-18 (Fri, 18 Mar 2022)

  Changed paths:
    M llvm/lib/Transforms/Scalar/LoopSimplifyCFG.cpp
    M llvm/test/Transforms/LoopSimplifyCFG/loop-not-in-simplify-form.ll

  Log Message:
  -----------
  [LoopSimplifyCFG] Check predecessors of exits before marking them dead.

LoopSimplifyCFG may process loops that are not in
loop-simplify/canonical form. For loops not in canonical form, exit
blocks may be reachable from non-loop blocks and we cannot consider them
as dead if they only are not reachable from the loop itself.

Unfortunately the smallest test I could come up with requires running
multiple passes:
    -passes='loop-mssa(loop-instsimplify,loop-simplifycfg,simple-loop-unswitch)'

The reason is that loops are canonicalized at the beginning of loop
pipelines, so a later transform has to break canonical form in a way
that breaks LoopSimplifyCFG's dead-exit analysis.

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

Fixes #54023, #49931.

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D121925




More information about the All-commits mailing list