fix ifcvt rtl sharing
Alan Modra
amodra@bigpond.net.au
Wed Aug 27 02:29:00 GMT 2003
This patch cures PR 12067, a combine problem caused by shared rtl. The
noce_try_cmove change is the specific fix for the bug report, the other
changes are by inspection for similar places that could run into rtl
sharing problems.
PR optimization/12067
* ifcvt.c (noce_try_cmove): Unshare cond rtl.
(noce_try_addcc): Likewise.
(noce_try_cmove_arith): Likewise.
(noce_get_alt_condition): Likewise.
Bootstrapped i686-linux, regression test in progress. OK for head/3.3?
Index: gcc/ifcvt.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ifcvt.c,v
retrieving revision 1.124
diff -u -p -r1.124 ifcvt.c
--- gcc/ifcvt.c 26 Jul 2003 18:38:42 -0000 1.124
+++ gcc/ifcvt.c 27 Aug 2003 01:59:57 -0000
@@ -900,7 +900,8 @@ noce_try_addcc (struct noce_if_info *if_
{
start_sequence ();
target = emit_conditional_add (if_info->x, code,
- XEXP (cond, 0), XEXP (cond, 1),
+ copy_rtx (XEXP (cond, 0)),
+ copy_rtx (XEXP (cond, 1)),
VOIDmode,
if_info->b, XEXP (if_info->a, 1),
GET_MODE (if_info->x),
@@ -1089,8 +1090,8 @@ noce_try_cmove (struct noce_if_info *if_
code = GET_CODE (if_info->cond);
target = noce_emit_cmove (if_info, if_info->x, code,
- XEXP (if_info->cond, 0),
- XEXP (if_info->cond, 1),
+ copy_rtx (XEXP (if_info->cond, 0)),
+ copy_rtx (XEXP (if_info->cond, 1)),
if_info->a, if_info->b);
if (target)
@@ -1232,8 +1233,9 @@ noce_try_cmove_arith (struct noce_if_inf
goto end_seq_and_fail;
}
- target = noce_emit_cmove (if_info, x, code, XEXP (if_info->cond, 0),
- XEXP (if_info->cond, 1), a, b);
+ target = noce_emit_cmove (if_info, x, code,
+ copy_rtx (XEXP (if_info->cond, 0)),
+ copy_rtx (XEXP (if_info->cond, 1)), a, b);
if (! target)
goto end_seq_and_fail;
@@ -1390,7 +1392,8 @@ noce_get_alt_condition (struct noce_if_i
|| op_a != XEXP (if_info->cond, 0)
|| op_b != XEXP (if_info->cond, 1))
{
- cond = gen_rtx_fmt_ee (code, GET_MODE (cond), op_a, op_b);
+ cond = gen_rtx_fmt_ee (code, GET_MODE (cond),
+ copy_rtx (op_a), copy_rtx (op_b));
*earliest = if_info->cond_earliest;
return cond;
}
--
Alan Modra
IBM OzLabs - Linux Technology Centre
More information about the Gcc-patches
mailing list