re PR tree-optimization/50605 (ice in ipa_get_jf_pass_through_result with -O3)

2011-11-18  Martin Jambor  <mjambor@suse.cz>

	PR tree-optimization/50605
	* gimple.c (is_gimple_ip_invariant_address): Also handle MEM_REFs
	of IPA invariant decls.

	* testsuite/g++.dg/ipa/pr50605.C: New test.

From-SVN: r181477
This commit is contained in:
Martin Jambor 2011-11-18 16:13:54 +01:00 committed by Martin Jambor
parent f252165363
commit 39cc8c3d6b
4 changed files with 62 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2011-11-18 Martin Jambor <mjambor@suse.cz>
PR tree-optimization/50605
* gimple.c (is_gimple_ip_invariant_address): Also handle MEM_REFs
of IPA invariant decls.
2011-11-18 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
* tree-outof-ssa.c (insert_back_edge_copies): Add call to

View File

@ -2858,8 +2858,18 @@ is_gimple_ip_invariant_address (const_tree t)
return false;
op = strip_invariant_refs (TREE_OPERAND (t, 0));
if (!op)
return false;
return op && (CONSTANT_CLASS_P (op) || decl_address_ip_invariant_p (op));
if (TREE_CODE (op) == MEM_REF)
{
const_tree op0 = TREE_OPERAND (op, 0);
return (TREE_CODE (op0) == ADDR_EXPR
&& (CONSTANT_CLASS_P (TREE_OPERAND (op0, 0))
|| decl_address_ip_invariant_p (TREE_OPERAND (op0, 0))));
}
return CONSTANT_CLASS_P (op) || decl_address_ip_invariant_p (op);
}
/* Return true if T is a GIMPLE minimal invariant. It's a restricted

View File

@ -1,3 +1,8 @@
2011-11-18 Martin Jambor <mjambor@suse.cz>
PR tree-optimization/50605
* g++.dg/ipa/pr50605.C: New test.
2011-11-18 Dodji Seketeli <dodji@redhat.com>
PR c++/51191

View File

@ -0,0 +1,40 @@
/* { dg-do compile } */
/* { dg-options "-O3 -fno-early-inlining" } */
class A
{
public:
int a;
void *stuff;
};
class B
{
public:
int b;
void *other_stuff;
A array[50];
};
extern B gb;
int process_A (A *a)
{
return a->a;
}
int process_A_complex (A *a)
{
return process_A (a+3);
}
int process_B (B *b)
{
return process_A_complex (&b->array[0]);
}
int foo (void)
{
return process_B (&gb);
}