On Tue, Oct 4, 2011 at 9:17 AM, Maxim Kuvyrkov <ma...@codesourcery.com> wrote: > Richard, > > The following patch fixes a CFG consistency problem. > > When early IPA optimizations (e.g., early SRA) create a version of a function > that no longer throws, versioning machinery deletes EH landings pads in > _callers_ of the function [*]. However, the EH cfg edges are not updated in > the callers, which eventually leads to an ICE in verify_eh_edges.
It needs to update EH edges in the callers via the common idiom if (maybe_clean_or_replace_eh_stmt (stmt, stmt) && gimple_purge_dead_eh_edges (gimple_bb (stmt))) ... arrange for cfg-cleanup to be run ... where the cfg-cleanup part probably explains why it doesn't. So one option is to not delete the landing pads. Where does it do that? I suppose it merely fails to properly transfer the EH info from the old to the new call (thus, fails to forcefully do what maybe_duplicate_eh_stmt does). Richard. > I've tried several ways to fix this, including trying to make early > optimizations not delete callers' landing pads. You are the original author > of the gimple EH code, and I wonder if you know the rationale behind removing > EH landing pads from callers or a function being optimized. > > The failure triggers on several libstdc++ testcases, but requires an > unrelated patch of mine (soon to be posted). > > In any case, attached is what appears to be the best way to fix this up. > > Bootstrapped and regrested on x86_64-linux-gnu. OK for trunk? > > Thank you, > > [*] this is done in cgraphunit.c: update_call_expr() and > ipa_modify_call_arguments() via maybe_clean[_and_replace]_eh_stmt(). > > -- > Maxim Kuvyrkov > CodeSourcery / Mentor Graphics > > >