This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Use validate_unshare_change in simplify_while_replacing
- From: Jie Zhang <jie dot zhang at analog dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 4 Jan 2010 15:27:23 +0800
- Subject: [PATCH] Use validate_unshare_change in simplify_while_replacing
Hi,
When I was experimenting the already removed SEE pass, I found this
issue in simplify_while_replacing. This can happen when
validate_replace_rtx_1 replaces two same RTLs in one insn. The new RTLs
are shared. Thus validate_replace_rtx_1 calls validate_unshare_change so
apply_change_group will unshare the RTLs. The problem is when
simplify_while_replacing is called at the end of validate_replace_rtx_1,
it uses validate_change instead of validate_unshare_change. It's still
possible to introduce shared RTLs when simplify. This patch makes
simplify_while_replacing call validate_unshare_change instead.
Bootstrapped on x86_64 and regression tested with C and C++. They are
OK. But I have no test case for this issue now, because this was found
with removed SEE pass. So is it OK to commit it now or just wait until a
new pass triggers this bug in future?
Regards,
Jie
* recog.c (simplify_while_replacing): Replace validate_change
with validate_unshare_change.
Index: recog.c
===================================================================
--- recog.c (revision 155472)
+++ recog.c (working copy)
@@ -556,19 +556,20 @@ simplify_while_replacing (rtx *loc, rtx
??? We may want later to remove this, once simplification is
separated from this function. */
if (CONST_INT_P (XEXP (x, 1)) && XEXP (x, 1) == to)
- validate_change (object, loc,
- simplify_gen_binary
- (PLUS, GET_MODE (x), XEXP (x, 0), XEXP (x, 1)), 1);
+ validate_unshare_change (object, loc,
+ simplify_gen_binary
+ (PLUS, GET_MODE (x), XEXP (x, 0),
+ XEXP (x, 1)), 1);
break;
case MINUS:
if (CONST_INT_P (XEXP (x, 1))
|| GET_CODE (XEXP (x, 1)) == CONST_DOUBLE)
- validate_change (object, loc,
- simplify_gen_binary
- (PLUS, GET_MODE (x), XEXP (x, 0),
- simplify_gen_unary (NEG,
- GET_MODE (x), XEXP (x, 1),
- GET_MODE (x))), 1);
+ validate_unshare_change (object, loc,
+ simplify_gen_binary
+ (PLUS, GET_MODE (x), XEXP (x, 0),
+ simplify_gen_unary (NEG,
+ GET_MODE (x), XEXP (x, 1),
+ GET_MODE (x))), 1);
break;
case ZERO_EXTEND:
case SIGN_EXTEND:
@@ -580,7 +581,7 @@ simplify_while_replacing (rtx *loc, rtx
we know won't be recognized. */
if (!new_rtx)
new_rtx = gen_rtx_CLOBBER (GET_MODE (x), const0_rtx);
- validate_change (object, loc, new_rtx, 1);
+ validate_unshare_change (object, loc, new_rtx, 1);
}
break;
case SUBREG:
@@ -592,7 +593,7 @@ simplify_while_replacing (rtx *loc, rtx
if (!new_rtx && GET_MODE (SUBREG_REG (x)) == VOIDmode)
new_rtx = gen_rtx_CLOBBER (GET_MODE (x), const0_rtx);
if (new_rtx)
- validate_change (object, loc, new_rtx, 1);
+ validate_unshare_change (object, loc, new_rtx, 1);
break;
case ZERO_EXTRACT:
case SIGN_EXTRACT:
@@ -644,8 +645,8 @@ simplify_while_replacing (rtx *loc, rtx
newmem = adjust_address_nv (XEXP (x, 0), wanted_mode, offset);
- validate_change (object, &XEXP (x, 2), GEN_INT (pos), 1);
- validate_change (object, &XEXP (x, 0), newmem, 1);
+ validate_unshare_change (object, &XEXP (x, 2), GEN_INT (pos), 1);
+ validate_unshare_change (object, &XEXP (x, 0), newmem, 1);
}
}