This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Fix PR ipa/60315 (inliner explosion)
- From: Jan Hubicka <hubicka at ucw dot cz>
- To: Eric Botcazou <ebotcazou at adacore dot com>
- Cc: Jan Hubicka <hubicka at ucw dot cz>, gcc-patches at gcc dot gnu dot org
- Date: Fri, 28 Mar 2014 23:21:00 +0100
- Subject: Re: Fix PR ipa/60315 (inliner explosion)
- Authentication-results: sourceware.org; auth=none
- References: <20140326021653 dot GA14614 at kam dot mff dot cuni dot cz> <20140327191118 dot GA24858 at kam dot mff dot cuni dot cz> <20140328153234 dot GA29079 at kam dot mff dot cuni dot cz> <1950630 dot hZYEJe06bi at polaris>
> > Actually after some additional invetstigation I decided to commit this
> > patch. fixup_noreturn_call already cares about the return value but
> > differently than the new Jakub's code.
>
> Thanks for the quick fix, I confirm that the ACATS failures are all gone.
>
> So we're left with the GIMPLE checking failure on opt33.adb.
Hi,
this is the patch I just comitted. It simply clears the static chain when needed.
Honza
* cgraph.c (cgraph_redirect_edge_call_stmt_to_callee): Clear
static chain if needed.
* gnat.dg/opt33.adb: New testcase.
Index: cgraph.c
===================================================================
--- cgraph.c (revision 208915)
+++ cgraph.c (working copy)
@@ -1488,6 +1488,14 @@ cgraph_redirect_edge_call_stmt_to_callee
gsi_insert_before (&gsi, set_stmt, GSI_SAME_STMT);
}
gimple_call_set_lhs (new_stmt, NULL_TREE);
+ update_stmt_fn (DECL_STRUCT_FUNCTION (e->caller->decl), new_stmt);
+ }
+
+ /* If new callee has no static chain, remove it. */
+ if (gimple_call_chain (new_stmt) && !DECL_STATIC_CHAIN (e->callee->decl))
+ {
+ gimple_call_set_chain (new_stmt, NULL);
+ update_stmt_fn (DECL_STRUCT_FUNCTION (e->caller->decl), new_stmt);
}
cgraph_set_call_stmt_including_clones (e->caller, e->call_stmt, new_stmt, false);
Index: testsuite/gnat.dg/opt33.adb
===================================================================
--- testsuite/gnat.dg/opt33.adb (revision 0)
+++ testsuite/gnat.dg/opt33.adb (revision 0)
@@ -0,0 +1,41 @@
+-- { dg-do compile }
+-- { dg-options "-O" }
+
+with Ada.Containers.Ordered_Sets;
+with Ada.Strings.Unbounded;
+
+procedure Opt33 is
+
+ type Rec is record
+ Name : Ada.Strings.Unbounded.Unbounded_String;
+ end record;
+
+ function "<" (Left : Rec; Right : Rec) return Boolean;
+
+ package My_Ordered_Sets is new Ada.Containers.Ordered_Sets (Rec);
+
+ protected type Data is
+ procedure Do_It;
+ private
+ Set : My_Ordered_Sets.Set;
+ end Data;
+
+ function "<" (Left : Rec; Right : Rec) return Boolean is
+ begin
+ return False;
+ end "<";
+
+ protected body Data is
+ procedure Do_It is
+ procedure Dummy (Position : My_Ordered_Sets.Cursor) is
+ begin
+ null;
+ end;
+ begin
+ Set.Iterate (Dummy'Access);
+ end;
+ end Data;
+
+begin
+ null;
+end;