This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] recog.c: Fix RTX unsharing in change groups - v2
- From: "Andreas Krebbel" <krebbel at linux dot vnet dot ibm dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 22 Mar 2011 08:46:32 +0100
- Subject: [PATCH] recog.c: Fix RTX unsharing in change groups - v2
Hi,
this is an alternate solution to the problem described in:
http://gcc.gnu.org/ml/gcc-patches/2011-03/msg00187.html
Although I still prefer the patch above since it would make
validate_change easier to use I understand that it might add
unnecessary unsharing. The unsharing for subsequent changes is only
needed if these changes re-use parts of previous changes and insert it
at a different location in the insn and that's probably a rare case.
Swapping operands like in canonicalize_change_group is one example
which can be easily fixed.
Done with the attached patch.
Ok for mainline?
Bye,
-Andreas-
2011-03-22 Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
* recog.c (canonicalize_change_group): Use validate_unshare_change.
Index: gcc/recog.c
===================================================================
*** gcc/recog.c.orig
--- gcc/recog.c
*************** canonicalize_change_group (rtx insn, rtx
*** 277,284 ****
/* Oops, the caller has made X no longer canonical.
Let's redo the changes in the correct order. */
rtx tem = XEXP (x, 0);
! validate_change (insn, &XEXP (x, 0), XEXP (x, 1), 1);
! validate_change (insn, &XEXP (x, 1), tem, 1);
return true;
}
else
--- 277,284 ----
/* Oops, the caller has made X no longer canonical.
Let's redo the changes in the correct order. */
rtx tem = XEXP (x, 0);
! validate_unshare_change (insn, &XEXP (x, 0), XEXP (x, 1), 1);
! validate_unshare_change (insn, &XEXP (x, 1), tem, 1);
return true;
}
else