This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH][tuples] Fix phiprop creating loads from functions


Bootstrap on IA64 currently fails building libjava because the phiprop
pass creates statements that load from a function into a register
of function type.  This later confuses SCCVN which doesn't expect
a FUNCTION_DECL RHS in a stmt loading from memory.

Indeed I think this is "invalid gimple", even though is_gimple_reg_type
says "yes" for FUNCTION_TYPE and METHOD_TYPE.

I fixed this locally within phiprop with the following.  Bootstrap
and regtest running.  Should I change is_gimple_reg_type instead?

Thanks,
Richard.

2008-07-21  Richard Guenther  <rguenther@suse.de>

	* tree-ssa-phiprop.c (propagate_with_phi): Avoid generating
	loads of functions.

	* gcc.c-torture/compile/20080721-1.c: New testcase.

Index: gcc/tree-ssa-phiprop.c
===================================================================
*** gcc/tree-ssa-phiprop.c	(revision 138030)
--- gcc/tree-ssa-phiprop.c	(working copy)
*************** propagate_with_phi (basic_block bb, gimp
*** 253,259 ****
  	}
        if ((TREE_CODE (arg) != ADDR_EXPR
  	   /* Avoid to have to decay *&a to a[0] later.  */
! 	   || !is_gimple_reg_type (TREE_TYPE (TREE_OPERAND (arg, 0))))
  	  && !(TREE_CODE (arg) == SSA_NAME
  	       && phivn[SSA_NAME_VERSION (arg)].value != NULL_TREE
  	       && phivn_valid_p (phivn, arg, bb)))
--- 253,262 ----
  	}
        if ((TREE_CODE (arg) != ADDR_EXPR
  	   /* Avoid to have to decay *&a to a[0] later.  */
! 	   || !is_gimple_reg_type (TREE_TYPE (TREE_OPERAND (arg, 0)))
! 	   /* Avoid "loading" functions.  */
! 	   || TREE_CODE (TREE_TYPE (TREE_OPERAND (arg, 0))) == FUNCTION_TYPE
! 	   || TREE_CODE (TREE_TYPE (TREE_OPERAND (arg, 0))) == METHOD_TYPE)
  	  && !(TREE_CODE (arg) == SSA_NAME
  	       && phivn[SSA_NAME_VERSION (arg)].value != NULL_TREE
  	       && phivn_valid_p (phivn, arg, bb)))
Index: gcc/testsuite/gcc.c-torture/compile/20080721-1.c
===================================================================
*** gcc/testsuite/gcc.c-torture/compile/20080721-1.c	(revision 0)
--- gcc/testsuite/gcc.c-torture/compile/20080721-1.c	(revision 0)
***************
*** 0 ****
--- 1,15 ----
+ void foo(void);
+ void bar(void);
+ 
+ int test(int b)
+ {
+   void *p, **q;
+   if (b)
+     p = (void *)foo;
+   else
+     p = (void *)bar;
+   q = (void **)p;
+   if (*q == (void *)0)
+     return 1;
+   return 0;
+ }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]