[PATCH] D31843: [LCSSA] Try to not walk the dominator tree more than necessary

Davide Italiano via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 12 18:23:31 PDT 2017


davide added a comment.

I convinced myself that the check is required.
Consider the following IR:

  define void @tinkywinky() {
  entry:
    br label %preheader
  preheader:                                        ; preds = %loop, %entry
    br label %loop
  loop:                                             ; preds = %stuff, %preheader
    indirectbr i8* undef, [label %preheader, label %stuff]
  stuff:                                            ; preds = %loop
    br label %loop
  }

We have one loop composed by two blocks [loop (header), stuffs] and one exit block [preheader].
preheader immediate dominator is entry, which doesn't belong to the loop, so I think that shouldn't be included in the set we're building (as we're not interested), but without the check it would. Does it make sense?


https://reviews.llvm.org/D31843





More information about the llvm-commits mailing list