[PATCH] D123230: [UnifyLoopExits] Reduce number of guard blocks

Brendon Cahoon via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 25 10:58:52 PDT 2022


bcahoon added a comment.

Hi @critson. Thanks for reducing the test case.  I don't see an error with the test case though, so I may be missing something.  Or, perhaps I need to see the complete test case? Here's my understanding. With the patch, control flow still converges at TrueExit. It's just that the Exit3 and Exit4 blocks have moved in the CFG so that they appear prior to loop.exit.guard rather than after. Following the exit paths from F, G, and C. I think that should be ok?

Before patch:
F -> loop.exit.guard ->loop.exit.guard1 -> Exit3 -> TrueExit
G -> loop.exit.guard -> loop.exit.guard1 -> Exit4 -> TrueExit
C -> loop.exit.guard -> Loop2.preheader -> Loop2 -> Exit2 -> TrueExit

After patch:
F -> Exit3 -> loop.exit.guard -> TrueExit
G -> Exit4 -> loop.exit.guard => TrueExit
C -> loop.exit.guard -> Loop2 -> Exit2 -> TrueExit

The CFG structure (hopefully the formatting works)
Before patch:

                C   F   G
                \   |   /
            loop.exit.guard
              /         \  
  Loop2PH/Loop2   loop.exit.guard1
       |               /      \
       \             Exit3 Exit4
        Exit2       /     /
             \     |     /
               TrueExit

After patch:

                F    G
                |    |
        C    Exit3 Exit4
          \     |     |
         loop.exit.guard
            /      \
  Loop2PH/Loop2    |
            |      |
         Exit2     /
             \    /
            TrueExit


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D123230



More information about the llvm-commits mailing list