This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PR tree-optimization/45463 (cgraph verification ICE)
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Jan Hubicka <hubicka at ucw dot cz>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Sun, 24 Oct 2010 06:35:01 -0700
- Subject: Re: PR tree-optimization/45463 (cgraph verification ICE)
- References: <20100916212237.GB6006@kam.mff.cuni.cz>
On Thu, Sep 16, 2010 at 2:22 PM, Jan Hubicka <hubicka@ucw.cz> wrote:
> Hi,
> the testcase shows situation where virtual function is inlined and contains
> recursive call. Inline the function makes it possible to devirtualize the
> call, but since we already eliminated the COMDAT function as unnecesary
> we mess up representing the direct call.
>
> This shows broader problem that COMDAT and EXTERN virtual methods whose vtables
> live in other unit are eliminated too early so we don't have chance to devirtualize
> them.
>
> This patch makes us to hold all those function until inlining when all devirtualization
> that matter should be already done.
>
> Bootstrapped/regtested x86_64-linux, will commit it shortly (with the testcase)
>
> struct S
> {
> ?S();
> ?virtual inline void foo ()
> ?{
> ? ?foo();
> ?}
> };
>
> void
> B ()
> {
> ?S().foo ();
> }
>
> ? ? ? ?* cgraphunit.c (cgraph_finalize_function): Consider comdat & external
> ? ? ? ?virtual functions are reachable.
> ? ? ? ?* ipa-inline.c (cgraph_clone_inlined_nodes): Likewise.
> ? ? ? ?* ipa.c (cgraph_remove_unreachable_nodes): Likewise.
> ? ? ? ?* ipa-prop.c (ipa_modify_formal_parameters): Clear DECL_VIRTUAL_P
> ? ? ? ?when modifying function.
This caused:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46154
H.J.