Fix properlyDominates for the case where an operation could dominate
another one appearing before it in the same block. The only paths to the
latter could be from the former.
Details
- Reviewers
lattner mehdi_amini
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Thank you for tackling this Uday!
The right check here is to see if the block isReachableFromEntry (which is a method of dominator set), not hasNoPredecessors().
It could be part of an unreachable cycle or something like that, in which the same (lack of) dominance properties hold.
The equivalent check in LLVM is here if it is helpful:
https://github.com/llvm/llvm-project/blob/master/llvm/lib/IR/Dominators.cpp#L258
Looks like I jumped on to the revision too quickly - but what you suggest above and the LLVM one goes against my understanding of the dominance model. Even if the use is unreachable from the entry, with this revision, you only consider it dominated if the def dominates the use (within that unreachable part). See lines 206-208 in the revision - hasNoPredecessors() isn't the only thing I'm doing. We could discuss this on the discussion forum first.
It could be part of an unreachable cycle or something like that, in which the same (lack of) dominance properties hold.