[PATCH] D35851: [Dominators] Include infinite loops in PostDominatorTree

Daniel Berlin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 9 17:55:36 PDT 2017


dberlin added a comment.

BTW, if you wish to convince yourself what i said about two identical PDTs not generating the same PDF, here is an example:

  define void @foo(i1 %cond, float* %a) {
  entry:
      br label %block1
   block1:
      br label %block3
   block3:
      br i1 true, label %block4, label %block4
   block4:
      ret void
  }

and

  define void @foo(i1 %cond, float* %a) {
  entry:
    br label %block1
   block1:
    br label %block3
   block3:
    br i1 true, label %block3, label %block4
   block4:
    ret void
  }



  Inorder PostDominator Tree: DFSNumbers invalid: 0 slow queries.
    [1]  <<exit node>> {4294967295,4294967295} [0]
      [2] %block4 {4294967295,4294967295} [1]
        [3] %block3 {4294967295,4294967295} [2]
          [4] %block1 {4294967295,4294967295} [3]
            [5] %entry {4294967295,4294967295} [4]
  Roots: %block4
  IDF for label %entry is: {}
  IDF for label %block1 is: {}
  IDF for label %block3 is: {}
  IDF for label %block4 is: {}

vs

  Inorder PostDominator Tree: DFSNumbers invalid: 0 slow queries.
    [1]  <<exit node>> {4294967295,4294967295} [0]
      [2] %block4 {4294967295,4294967295} [1]
        [3] %block3 {4294967295,4294967295} [2]
          [4] %block1 {4294967295,4294967295} [3]
            [5] %entry {4294967295,4294967295} [4]
  Roots: %block4
  IDF for label %entry is: {}
  IDF for label %block1 is: {}
  IDF for label %block3 is: {label %block3 , }
  IDF for label %block4 is: {}

As you can see, i've changed the PostDominanceFrontier without changing the PDT by varying strict postdomination of successors.

Also someone pointed out to me today. If you want another literature reference for virtual edges for infinite loops, Bob Morgan's Building an Optimizing Compiler covers it, see pages 82-83 and figure 3.10.


https://reviews.llvm.org/D35851





More information about the llvm-commits mailing list