This is the mail archive of the
mailing list for the GCC project.
Hack around regrename sharing issues
- From: Jan Hubicka <jh at suse dot cz>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 20 Dec 2006 14:14:03 +0100
- Subject: Hack around regrename sharing issues
this patch fix invalid sharing in regrename.c. The patch is quite ugly - the
problem is that regrename.c enforces sharing on all
/* For match_dup of match_operator or match_parallel, share
them, so that we don't miss changes in the dup. */
and in the rs6000 case it is whole (xor (reg) (constant)) expression.
As a result we end up copying every such match_operand once again even
if we didn't changed anything.
It is not quite easy to reorganize the code to not do this ugly trick, so I
propose this patch as temporary fix. The code should be arguably rewriten
to use df.c API hopefully using new dataflow branch infrastructure instead
of doing it's own df/ud chain building.
I don't want to introduce make the plan of fixing RTl sharing dependent on
dataflow branch merge (because I believe dataflow branch merge depends on the
sharing too - Kenny is trying to keep track of every instructio change and if
you change instructions inderectly by invalid sharing, you run into mismatches
quickly), so this seems as feasible alternative. it is not terribly bad because
1) the code is run at -O3 only, 2) the number of dups is quite low so we don't
produce more garbage than in other passes, say cselib.
It was bootstrapped/regtested ppc-linux, OK?
* regrename.c (build_def_use): Don't introduce invalid sharing.
--- regrename.c (revision 120037)
+++ regrename.c (working copy)
@@ -836,7 +836,7 @@
for (i = 0; i < recog_data.n_dups; i++)
- *recog_data.dup_loc[i] = old_dups[i];
+ *recog_data.dup_loc[i] = copy_rtx (old_dups[i]);
for (i = 0; i < n_ops; i++)
*recog_data.operand_loc[i] = old_operands[i];
@@ -1760,7 +1760,7 @@
recog_data.operand[i] = new;
for (j = 0; j < recog_data.n_dups; j++)
if (recog_data.dup_num[j] == i)
- validate_change (insn, recog_data.dup_loc[j], new, 1);
+ validate_change (insn, recog_data.dup_loc[j], copy_rtx (new), 1);
any_replacements = true;