This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Different attempt to fix regrename sharing problems
- From: Jan Hubicka <jh at suse dot cz>
- To: gcc-patches at gcc dot gnu dot org, jakub at redhat dot com, mark at codesourcery dot com
- Date: Fri, 17 Aug 2007 15:07:03 +0200
- Subject: Different attempt to fix regrename sharing problems
Hi,
this is alternate patch for regrename sharing problems. The code
forcing sharing was introduced here:
http://gcc.gnu.org/ml/gcc-patches/2002-03/msg01485.html
It seems to me that the analysis is not quite correct - regrename is
basically looking for bad uses of registers that are not ones handled by
match_operand first (such as dirrect references to registers from insn
patterns) and excludes any such registers from renaming since renaming
can't be validated based on constraints.
This is done by patching instruction and replacing every match_operand
by cc0_rtx scaning the instruction for everything remaining.
The code handling match_dup basically kills match_dup parts of RTL too
so we don't need to do the substitutions in matched copies and still
don't end up seeing operands oterwise validatable by constraints.
Then instruction is patched back and renaming is done. Since regrename
is basically replacing either all uses in instructions or all defs, it
should always keep both match_dup arms in match. Only two cases can
cause mismatch - when match_dup is mathcing output operand with input
that is invalid anyway (we use "0" constraints for this) or when there
was invalid sharing in RTL causing some unexpected rewrites that I think
was probably the case of original failure.
Does this seem to make sense? I've bootstrapped/regtested ppc-linux
where the failure was fixed by original patch and also
ia64-linux/x86-linux and x86-64-linux with earlier version of the patch.
I am re-testing with this one.
Honza
* regrename.c (build_def_use): Don't share RTL between MATCH_OPERATOR
and corresponding MATCH_DUP.
Index: regrename.c
===================================================================
*** regrename.c (revision 127395)
--- regrename.c (working copy)
*************** build_def_use (basic_block bb)
*** 806,821 ****
}
for (i = 0; i < recog_data.n_dups; i++)
{
- int dup_num = recog_data.dup_num[i];
-
old_dups[i] = *recog_data.dup_loc[i];
*recog_data.dup_loc[i] = cc0_rtx;
-
- /* For match_dup of match_operator or match_parallel, share
- them, so that we don't miss changes in the dup. */
- if (icode >= 0
- && insn_data[icode].operand[dup_num].eliminable == 0)
- old_dups[i] = recog_data.operand[dup_num];
}
scan_rtx (insn, &PATTERN (insn), NO_REGS, terminate_all_read,
--- 806,813 ----