summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2013-03-12 12:13:33 +0000
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2013-03-12 12:13:33 +0000
commitb291008a661fa05b2cb182ddb471ff8dd4a09ae1 (patch)
tree30e6ccc292873e9eb78fa8523acc6926a4f44121
parent1c72da597a6c73f5843814dfa878e6f779564c72 (diff)
downloadgcc-b291008a661fa05b2cb182ddb471ff8dd4a09ae1.tar.gz
PR middle-end/56571
* valtrack.c (cleanup_auto_inc_dec): Unshare clobbers originating from pseudos. * emit-rtl.c (verify_rtx_sharing): Likewise. (copy_insn_1): Likewise. * rtl.c (copy_rtx): Likewise. PR middle-end/56571 * gcc.c-torture/compile/pr56571.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@196612 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/emit-rtl.c20
-rw-r--r--gcc/rtl.c6
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr56571.c8
-rw-r--r--gcc/valtrack.c6
6 files changed, 48 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index a31a28e92cc..8fad9e630a9 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,12 @@
+2013-03-11 Jan Hubicka <jh@suse.cz>
+
+ PR middle-end/56571
+ * valtrack.c (cleanup_auto_inc_dec): Unshare clobbers originating
+ from pseudos.
+ * emit-rtl.c (verify_rtx_sharing): Likewise.
+ (copy_insn_1): Likewise.
+ * rtl.c (copy_rtx): Likewise.
+
2013-03-11 Georg-Johann Lay <avr@gjlay.de>
PR target/56591
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index 2c70fb1841d..59cd38d40f4 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -2580,10 +2580,14 @@ verify_rtx_sharing (rtx orig, rtx insn)
case RETURN:
case SIMPLE_RETURN:
case SCRATCH:
- return;
/* SCRATCH must be shared because they represent distinct values. */
+ return;
case CLOBBER:
- if (REG_P (XEXP (x, 0)) && REGNO (XEXP (x, 0)) < FIRST_PSEUDO_REGISTER)
+ /* Share clobbers of hard registers (like cc0), but do not share pseudo reg
+ clobbers or clobbers of hard registers that originated as pseudos.
+ This is needed to allow safe register renaming. */
+ if (REG_P (XEXP (x, 0)) && REGNO (XEXP (x, 0)) < FIRST_PSEUDO_REGISTER
+ && ORIGINAL_REGNO (XEXP (x, 0)) == REGNO (XEXP (x, 0)))
return;
break;
@@ -2797,7 +2801,11 @@ repeat:
/* SCRATCH must be shared because they represent distinct values. */
return;
case CLOBBER:
- if (REG_P (XEXP (x, 0)) && REGNO (XEXP (x, 0)) < FIRST_PSEUDO_REGISTER)
+ /* Share clobbers of hard registers (like cc0), but do not share pseudo reg
+ clobbers or clobbers of hard registers that originated as pseudos.
+ This is needed to allow safe register renaming. */
+ if (REG_P (XEXP (x, 0)) && REGNO (XEXP (x, 0)) < FIRST_PSEUDO_REGISTER
+ && ORIGINAL_REGNO (XEXP (x, 0)) == REGNO (XEXP (x, 0)))
return;
break;
@@ -5303,7 +5311,11 @@ copy_insn_1 (rtx orig)
case SIMPLE_RETURN:
return orig;
case CLOBBER:
- if (REG_P (XEXP (orig, 0)) && REGNO (XEXP (orig, 0)) < FIRST_PSEUDO_REGISTER)
+ /* Share clobbers of hard registers (like cc0), but do not share pseudo reg
+ clobbers or clobbers of hard registers that originated as pseudos.
+ This is needed to allow safe register renaming. */
+ if (REG_P (XEXP (orig, 0)) && REGNO (XEXP (orig, 0)) < FIRST_PSEUDO_REGISTER
+ && ORIGINAL_REGNO (XEXP (orig, 0)) == REGNO (XEXP (orig, 0)))
return orig;
break;
diff --git a/gcc/rtl.c b/gcc/rtl.c
index bc49fc86fe9..b2d88f783b7 100644
--- a/gcc/rtl.c
+++ b/gcc/rtl.c
@@ -256,7 +256,11 @@ copy_rtx (rtx orig)
/* SCRATCH must be shared because they represent distinct values. */
return orig;
case CLOBBER:
- if (REG_P (XEXP (orig, 0)) && REGNO (XEXP (orig, 0)) < FIRST_PSEUDO_REGISTER)
+ /* Share clobbers of hard registers (like cc0), but do not share pseudo reg
+ clobbers or clobbers of hard registers that originated as pseudos.
+ This is needed to allow safe register renaming. */
+ if (REG_P (XEXP (orig, 0)) && REGNO (XEXP (orig, 0)) < FIRST_PSEUDO_REGISTER
+ && ORIGINAL_REGNO (XEXP (orig, 0)) == REGNO (XEXP (orig, 0)))
return orig;
break;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 578f0da29cd..f4af3d5c34c 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2013-03-11 Jan Hubicka <jh@suse.cz>
+
+ PR middle-end/56571
+ * gcc.c-torture/compile/pr56571.c: New testcase.
+
2013-03-11 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
* gcc.dg/tree-ssa/vector-4.c: Add comment regarding xfail.
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr56571.c b/gcc/testsuite/gcc.c-torture/compile/pr56571.c
new file mode 100644
index 00000000000..248148c9ff8
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr56571.c
@@ -0,0 +1,8 @@
+/* { dg-options "-funroll-loops -ftracer" } */
+int a, b;
+
+int f(void)
+{
+ (a % b) && f();
+ a = (0 || a | (a ? : 1));
+}
diff --git a/gcc/valtrack.c b/gcc/valtrack.c
index 87ce3f665b0..997f68b5089 100644
--- a/gcc/valtrack.c
+++ b/gcc/valtrack.c
@@ -71,7 +71,11 @@ cleanup_auto_inc_dec (rtx src, enum machine_mode mem_mode ATTRIBUTE_UNUSED)
/* SCRATCH must be shared because they represent distinct values. */
return x;
case CLOBBER:
- if (REG_P (XEXP (x, 0)) && REGNO (XEXP (x, 0)) < FIRST_PSEUDO_REGISTER)
+ /* Share clobbers of hard registers (like cc0), but do not share pseudo reg
+ clobbers or clobbers of hard registers that originated as pseudos.
+ This is needed to allow safe register renaming. */
+ if (REG_P (XEXP (x, 0)) && REGNO (XEXP (x, 0)) < FIRST_PSEUDO_REGISTER
+ && ORIGINAL_REGNO (XEXP (x, 0)) == REGNO (XEXP (x, 0)))
return x;
break;