Commit 92b3326b by Richard Biener Committed by Richard Biener

re PR ipa/60912 (wrong code with -O -fno-inline -fipa-pta)

2014-04-25  Richard Biener  <rguenther@suse.de>

	PR ipa/60912
	* tree-ssa-structalias.c (ipa_pta_execute): Compute direct
	call stmt use/clobber sets during stmt walk instead of
	walking the possibly incomplete set of caller edges.

	* g++.dg/opt/pr60912.C: New testcase.

From-SVN: r209780
parent 78422fb1
2014-04-25 Richard Biener <rguenther@suse.de> 2014-04-25 Richard Biener <rguenther@suse.de>
PR ipa/60912
* tree-ssa-structalias.c (ipa_pta_execute): Compute direct
call stmt use/clobber sets during stmt walk instead of
walking the possibly incomplete set of caller edges.
2014-04-25 Richard Biener <rguenther@suse.de>
PR ipa/60911 PR ipa/60911
* passes.c (apply_ipa_transforms): Inline into only caller ... * passes.c (apply_ipa_transforms): Inline into only caller ...
(execute_one_pass): ... here. Properly bring in function (execute_one_pass): ... here. Properly bring in function
......
2014-04-25 Richard Biener <rguenther@suse.de> 2014-04-25 Richard Biener <rguenther@suse.de>
PR ipa/60912
* g++.dg/opt/pr60912.C: New testcase.
2014-04-25 Richard Biener <rguenther@suse.de>
PR ipa/60911 PR ipa/60911
* gcc.dg/lto/pr60911_0.c: New testcase. * gcc.dg/lto/pr60911_0.c: New testcase.
......
// { dg-do run }
// { dg-options "-O -fno-inline -fipa-pta" }
struct IFoo
{
virtual void Foo () = 0;
};
struct Bar:IFoo
{
void Foo () {}
};
int main ()
{
(new Bar ())->Foo ();
return 0;
}
...@@ -7244,10 +7244,7 @@ ipa_pta_execute (void) ...@@ -7244,10 +7244,7 @@ ipa_pta_execute (void)
tree ptr; tree ptr;
struct function *fn; struct function *fn;
unsigned i; unsigned i;
varinfo_t fi;
basic_block bb; basic_block bb;
struct pt_solution uses, clobbers;
struct cgraph_edge *e;
/* Nodes without a body are not interesting. */ /* Nodes without a body are not interesting. */
if (!cgraph_function_with_gimple_body_p (node) || node->clone_of) if (!cgraph_function_with_gimple_body_p (node) || node->clone_of)
...@@ -7263,21 +7260,6 @@ ipa_pta_execute (void) ...@@ -7263,21 +7260,6 @@ ipa_pta_execute (void)
find_what_p_points_to (ptr); find_what_p_points_to (ptr);
} }
/* Compute the call-use and call-clobber sets for all direct calls. */
fi = lookup_vi_for_tree (node->decl);
gcc_assert (fi->is_fn_info);
clobbers
= find_what_var_points_to (first_vi_for_offset (fi, fi_clobbers));
uses = find_what_var_points_to (first_vi_for_offset (fi, fi_uses));
for (e = node->callers; e; e = e->next_caller)
{
if (!e->call_stmt)
continue;
*gimple_call_clobber_set (e->call_stmt) = clobbers;
*gimple_call_use_set (e->call_stmt) = uses;
}
/* Compute the call-use and call-clobber sets for indirect calls /* Compute the call-use and call-clobber sets for indirect calls
and calls to external functions. */ and calls to external functions. */
FOR_EACH_BB_FN (bb, fn) FOR_EACH_BB_FN (bb, fn)
...@@ -7288,17 +7270,27 @@ ipa_pta_execute (void) ...@@ -7288,17 +7270,27 @@ ipa_pta_execute (void)
{ {
gimple stmt = gsi_stmt (gsi); gimple stmt = gsi_stmt (gsi);
struct pt_solution *pt; struct pt_solution *pt;
varinfo_t vi; varinfo_t vi, fi;
tree decl; tree decl;
if (!is_gimple_call (stmt)) if (!is_gimple_call (stmt))
continue; continue;
/* Handle direct calls to external functions. */ /* Handle direct calls to functions with body. */
decl = gimple_call_fndecl (stmt); decl = gimple_call_fndecl (stmt);
if (decl if (decl
&& (!(fi = lookup_vi_for_tree (decl)) && (fi = lookup_vi_for_tree (decl))
|| !fi->is_fn_info)) && fi->is_fn_info)
{
*gimple_call_clobber_set (stmt)
= find_what_var_points_to
(first_vi_for_offset (fi, fi_clobbers));
*gimple_call_use_set (stmt)
= find_what_var_points_to
(first_vi_for_offset (fi, fi_uses));
}
/* Handle direct calls to external functions. */
else if (decl)
{ {
pt = gimple_call_use_set (stmt); pt = gimple_call_use_set (stmt);
if (gimple_call_flags (stmt) & ECF_CONST) if (gimple_call_flags (stmt) & ECF_CONST)
...@@ -7342,10 +7334,9 @@ ipa_pta_execute (void) ...@@ -7342,10 +7334,9 @@ ipa_pta_execute (void)
pt->nonlocal = 1; pt->nonlocal = 1;
} }
} }
/* Handle indirect calls. */ /* Handle indirect calls. */
if (!decl else if (!decl
&& (fi = get_fi_for_callee (stmt))) && (fi = get_fi_for_callee (stmt)))
{ {
/* We need to accumulate all clobbers/uses of all possible /* We need to accumulate all clobbers/uses of all possible
callees. */ callees. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment