On Mon, Aug 17, 2015 at 11:31:57AM -0600, Jeff Law wrote:
> The funny thing here is we remove the statements after the trap to avoid
> this exact situation!
>
> I think the problem with schemes that either change the order of block
> processing, or which ignore some blocks are going to run into issues. By
> walking blocks and statements in a backwards order, we address 99% of the
> problems, including uses in PHIs in a direct successor block.
>
> What's not handled is a use in a PHI at the frontier of a subgraph that
> becomes unreachable. We'd have to do the usual unreachable block analysis
> to catch and handle those properly.
>
> I don't particularly like that idea....
>
> But in walking through all that, I think I've stumbled on a simpler
> solution. Specifically do as a little as possible and let the standard
> mechanisms clean things up :-)
>
> 1. Delete the code that removes instructions after the trap.
>
> 2. Split the block immediately after the trap and remove the edge
> from the original block (with the trap) to the new block.
>
>
> THen let the standard mechanisms handle things when that pass is complete.
>
> By setting cfg_altered, we'll get unreachable code removal which will
> capture most of the intended effect. DCE fires a couple more passes down in
> the pipeline to pick up the remaining tidbits.
Ok, thanks.
> Do you want to try and tackle this?
Sure. I should have a patch tomorrow :-).
Marek