This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] (wrong) Fix IVOPTS rewrite_address_base (!?)
- From: Richard Guenther <rguenth at tat dot physik dot uni-tuebingen dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 2 Jun 2005 11:10:02 +0200 (CEST)
- Subject: [PATCH] (wrong) Fix IVOPTS rewrite_address_base (!?)
Ok, here's my shot at fixing my problems mentioned in
http://gcc.gnu.org/ml/gcc/2005-06/msg00021.html
Basically it looks like the wrong "part" of *op is rewritten
(i.e. we get the base address (bvar), but do not use it).
Of course it doesn't survive bootstrap - I seem to mess up
with virtual operands or such. I know too little about
IVOPTS anyway - please someone help me here.
Thanks!
Richard.
Index: tree-ssa-loop-ivopts.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-loop-ivopts.c,v
retrieving revision 2.73
diff -c -3 -p -r2.73 tree-ssa-loop-ivopts.c
*** tree-ssa-loop-ivopts.c 26 May 2005 18:14:48 -0000 2.73
--- tree-ssa-loop-ivopts.c 2 Jun 2005 08:51:37 -0000
*************** rewrite_address_base (block_stmt_iterato
*** 5422,5427 ****
--- 5420,5433 ----
bsi_insert_before (bsi, copy, BSI_SAME_STMT);
with = new_name;
+ if (TREE_CODE (bvar) == INDIRECT_REF)
+ {
+ orig = REF_ORIGINAL (bvar);
+ TREE_OPERAND (bvar, 0) = with;
+ REF_ORIGINAL (bvar) = orig;
+ goto out;
+ }
+
do_rewrite:
orig = NULL_TREE;
*************** do_rewrite:
*** 5433,5443 ****
if (!orig)
orig = unshare_and_remove_ssa_names (*op);
! *op = build1 (INDIRECT_REF, TREE_TYPE (*op), with);
/* Record the original reference, for purposes of alias analysis. */
REF_ORIGINAL (*op) = orig;
/* Virtual operands in the original statement may have to be renamed
because of the replacement. */
mark_new_vars_to_rename (bsi_stmt (*bsi));
--- 5439,5451 ----
if (!orig)
orig = unshare_and_remove_ssa_names (*op);
! gcc_assert (TREE_TYPE (*op) == TREE_TYPE (TREE_TYPE (with)));
! *op = build (INDIRECT_REF, TREE_TYPE (*op), with);
/* Record the original reference, for purposes of alias analysis. */
REF_ORIGINAL (*op) = orig;
+ out:
/* Virtual operands in the original statement may have to be renamed
because of the replacement. */
mark_new_vars_to_rename (bsi_stmt (*bsi));