On Fri, Oct 30, 2015 at 1:14 PM, Richard Sandiford <richard.sandif...@arm.com> wrote: > Richard Biener <richard.guent...@gmail.com> writes: >> On Fri, Oct 30, 2015 at 12:18 PM, Richard Sandiford >> <richard.sandif...@arm.com> wrote: >>> The pass would free the dominance info after making a change, but it >>> should be pretty easy to keep the information up-to-date when the call >>> has no EH edges. In a way the main hurdle was split_block, which seemed >>> to assume that the new block would postdominate the old one, and that >>> all blocks immediately dominated by the old block are now immediately >>> dominated by the new one. >>> >>> Tested on x86_64-linux-gnu, arm-linux-gnueabi and aarch64-linux-gnu. >>> OK to install? >> >> Hmm, I don't understand why split_block needs to be touched. The >> operation itself correctly updates dominator info. It is up to the >> pass to fix things up if it does further CFG modifications that make >> the new block no longer post-dominate the old one. >> >> So why do you need the split_block change? > > The updates we'd need here would be: > > redirect_immediate_dominators (CDI_DOMINATORS, call, guard_bb); > > which undoes the earlier: > > redirect_immediate_dominators (CDI_DOMINATORS, guard_bb, call); > > that split_block did. It just seemed wasteful to call > redirect_immediate_dominators twice to get a no-op. > > In other words, there are going to be callers to split_block that > know the second block isn't going to postdominate the first and > where the calling; > > redirect_immediate_dominators (CDI_DOMINATORS, first_block, > second_block); > > is taking us further from where we want to be.
That's true. In an ideal world we'd have a CFG hook creating a (half) diamond directly. I wonder how other passes work around this issue? I suppose they are splitting the block to form the conditonal block and the joiner? If you have those and then only split the fallthru edge between them the redundant work done is minimal. Richard. > Thanks, > Richard >