This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[tree-ssa] must-alias fixes...
- From: Jan Hubicka <hubicka at ucw dot cz>
- To: gcc-patches at gcc dot gnu dot org, rth at redhat dot com
- Date: Fri, 21 Nov 2003 00:51:40 +0100
- Subject: [tree-ssa] must-alias fixes...
Hi,
this patch contains all fixes I accumulated for aliasing, all of these were
discussed earlier. With some furhter massaging I can now bootstrap with tail
call optimization enabled on machines where it failed same way as for nightly
testers, but I want to send this part separately.
This patch has been tested on i686-linux on RH machine, partly on i386-linux
Debian machine (libstdc++ fails for unrelated reasons) and x86-64-linux
(libjava fails for unrelated reasons). Given the bugfixing nature, I hope this
testing is fine. I will try to sort out the other reasons.
OK?
Honza
2003-11-21 Jan Hubicka <jh@suse.cz>
* tree-must-alias.c (tree_compute_must_alias): Promote pointers.
(find_addressable_vars): Deal with complex references.
(promote_var): Do not clear may_point_to_global_mem
* tree-dfa.c (get_expr_operands): FIx handling of i386.
Index: tree-must-alias.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-must-alias.c,v
retrieving revision 1.1.2.8
diff -c -3 -p -r1.1.2.8 tree-must-alias.c
*** tree-must-alias.c 11 Nov 2003 18:04:46 -0000 1.1.2.8
--- tree-must-alias.c 20 Nov 2003 23:40:50 -0000
*************** tree_compute_must_alias (tree fndecl, sb
*** 93,100 ****
/* We are only interested in disambiguating addressable locals. */
if (TREE_ADDRESSABLE (var)
! /* FIXME Why exactly do we need to ignore pointers and arrays? */
! && !POINTER_TYPE_P (TREE_TYPE (var))
&& TREE_CODE (TREE_TYPE (var)) != ARRAY_TYPE
&& decl_function_context (var) == current_function_decl
&& !DECL_NONLOCAL (var)
--- 93,99 ----
/* We are only interested in disambiguating addressable locals. */
if (TREE_ADDRESSABLE (var)
! /* FIXME Why exactly do we need to ignore arrays? */
&& TREE_CODE (TREE_TYPE (var)) != ARRAY_TYPE
&& decl_function_context (var) == current_function_decl
&& !DECL_NONLOCAL (var)
*************** find_addressable_vars (sbitmap addresses
*** 172,180 ****
--- 171,193 ----
{
tree t = PHI_ARG_DEF (phi, i);
+ if (TREE_CODE (t) == NOP_EXPR)
+ t = TREE_OPERAND (t, 0);
+
+ if (TREE_CODE (t) == PLUS_EXPR)
+ t = TREE_OPERAND (t, 0);
+
+ if (TREE_CODE (t) == NOP_EXPR)
+ t = TREE_OPERAND (t, 0);
+
if (TREE_CODE (t) != ADDR_EXPR)
continue;
t = TREE_OPERAND (t, 0);
+ if (TREE_CODE (t) == ARRAY_REF
+ || TREE_CODE (t) == COMPONENT_REF
+ || TREE_CODE (t) == REALPART_EXPR
+ || TREE_CODE (t) == IMAGPART_EXPR)
+ t = TREE_OPERAND (t, 0);
if (TREE_CODE (t) != VAR_DECL && TREE_CODE (t) != PARM_DECL)
continue;
SET_BIT (addresses_needed, var_ann (t)->uid);
*************** promote_var (tree var, sbitmap vars_to_r
*** 217,223 ****
ann->may_aliases = NULL;
ann->is_call_clobbered = 0;
ann->may_alias_global_mem = 0;
- ann->may_point_to_global_mem = 0;
/* If the variable was an alias tag, remove it from every variable that
had it in its may-alias set. */
--- 230,235 ----
Index: tree-dfa.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-dfa.c,v
retrieving revision 1.1.4.181
diff -c -3 -p -r1.1.4.181 tree-dfa.c
*** tree-dfa.c 19 Nov 2003 20:10:00 -0000 1.1.4.181
--- tree-dfa.c 20 Nov 2003 23:40:51 -0000
*************** get_expr_operands (tree stmt, tree *expr
*** 467,473 ****
get_expr_operands (stmt, &TREE_OPERAND (expr, 0), opf_none, prev_vops);
for (op = TREE_OPERAND (expr, 1); op; op = TREE_CHAIN (op))
! add_stmt_operand (&TREE_VALUE (op), stmt, opf_none, prev_vops);
if (num_call_clobbered_vars > 0)
{
--- 467,473 ----
get_expr_operands (stmt, &TREE_OPERAND (expr, 0), opf_none, prev_vops);
for (op = TREE_OPERAND (expr, 1); op; op = TREE_CHAIN (op))
! get_expr_operands (stmt, &TREE_VALUE (op), opf_none, prev_vops);
if (num_call_clobbered_vars > 0)
{