The dominator tree has to be updated after all instructions for an
unreachable block have been removed.
This patch should fix all NewGVN test failures with EXPENSIVE_CHECKS.
Differential D29252
[NewGVN] Update dominator tree for unreachable blocks. fhahn on Jan 28 2017, 6:36 AM. Authored by
Details
Diff Detail Event Timeline
Comment Actions Yeah, we discovered this yesterday. The underlying issue is twofold
I'm torn here. Chandler's suggestion was to preserve the CFG. That will work, actually, right up until we add PRE. Current GVN does not preserve CFG. NewGVN is also an analysis with an elimination pass tacked on (and built so we can eventually split it up that way). The analysis should not modify the CFG for sure, but it isn't right now, so that's okay. Chandler, your thoughts welcome on whether it's worth trying to preserve CFG in the case we don't do PRE Comment Actions There is no fundamental reason you should preserve the CFG. The reason I suggest it whenever possible is only because it allows us to cache many more analyses. You can update domtree, but the number of analyses you get to preserve by preserving the CFG goes up *substantially* and you don't want to try to update all of them. That said,, as long as this is one big pass, as you say, you'll want to split critical edges in part of it, etc. Don't stress about it in that context. If you're going to split this, I think it is fairly likely that some reduced transformation passes will want to preserve the CFG so they can be relatively non-disruptive to analyses. Some use cases off the top of my head:
Anyways, all of this seems pretty forward-looking, so I don't think it should necessarily decide what you do right now, just something to keep in mind as things progress. If there are easy ways to set the pass up for this long term, might be worthwhile. Comment Actions @davide should I abandon this review now you opened https://llvm.org/bugs/show_bug.cgi?id=31801 ? Comment Actions No, I think something like this should go in anyway. PR30801 tracks a more general problem that will require time to be addressed properly. Comment Actions For now i think we should revert the original change and insert the store, unless someone has evidence that doing something else produces actual performance improvement, instead of just looking nicer We can always burn this bridge again when we come to it. |
Another possibility would be to add a function to recursively erase all nodes dominated by BB. What do you think?