summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2014-02-12 08:49:55 +0000
committerebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2014-02-12 08:49:55 +0000
commitb74177237684bc892ed27e50f5d6f2ddc6f7a0c2 (patch)
tree978e4087ca2bdbd4afd96388ab25a7caa8853cda
parentde7822787195e4b0af134a143fe6705a5c9a7772 (diff)
downloadppe42-gcc-b74177237684bc892ed27e50f5d6f2ddc6f7a0c2.tar.gz
ppe42-gcc-b74177237684bc892ed27e50f5d6f2ddc6f7a0c2.zip
PR rtl-optimization/60116
* combine.c (try_combine): Also remove dangling REG_DEAD notes on the other_insn once the combination has been validated. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@207713 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/combine.c9
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/20140212-1.c37
4 files changed, 52 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 9b501585f67..a92902bcb11 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2014-02-12 Eric Botcazou <ebotcazou@adacore.com>
+
+ PR rtl-optimization/60116
+ * combine.c (try_combine): Also remove dangling REG_DEAD notes on the
+ other_insn once the combination has been validated.
+
2014-02-11 Jan Hubicka <hubicka@ucw.cz>
PR lto/59468
diff --git a/gcc/combine.c b/gcc/combine.c
index fd4294bdd63..f6e1dbc4686 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -3894,14 +3894,15 @@ try_combine (rtx i3, rtx i2, rtx i1, rtx i0, int *new_direct_jump_p,
PATTERN (undobuf.other_insn) = other_pat;
- /* If any of the notes in OTHER_INSN were REG_UNUSED, ensure that they
- are still valid. Then add any non-duplicate notes added by
- recog_for_combine. */
+ /* If any of the notes in OTHER_INSN were REG_DEAD or REG_UNUSED,
+ ensure that they are still valid. Then add any non-duplicate
+ notes added by recog_for_combine. */
for (note = REG_NOTES (undobuf.other_insn); note; note = next)
{
next = XEXP (note, 1);
- if (REG_NOTE_KIND (note) == REG_UNUSED
+ if ((REG_NOTE_KIND (note) == REG_DEAD
+ || REG_NOTE_KIND (note) == REG_UNUSED)
&& ! reg_set_p (XEXP (note, 0), PATTERN (undobuf.other_insn)))
remove_note (undobuf.other_insn, note);
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 2505b6a5882..5555d3edb7b 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2014-02-12 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc.c-torture/execute/20140212-1.c: New test.
+
2014-02-12 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/60047
diff --git a/gcc/testsuite/gcc.c-torture/execute/20140212-1.c b/gcc/testsuite/gcc.c-torture/execute/20140212-1.c
new file mode 100644
index 00000000000..8f1f84f3e3c
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/20140212-1.c
@@ -0,0 +1,37 @@
+/* PR rtl-optimization/60116 */
+/* Reported by Zhendong Su <su@cs.ucdavis.edu> */
+
+extern void abort (void);
+
+int a, b, c, d = 1, e, f = 1, h, i, k;
+char g, j;
+
+void
+fn1 (void)
+{
+ int l;
+ e = 0;
+ c = 0;
+ for (;;)
+ {
+ k = a && b;
+ j = k * 54;
+ g = j * 147;
+ l = ~g + (long long) e && 1;
+ if (d)
+ c = l;
+ else
+ h = i = l * 9UL;
+ if (f)
+ return;
+ }
+}
+
+int
+main (void)
+{
+ fn1 ();
+ if (c != 1)
+ abort ();
+ return 0;
+}
OpenPOWER on IntegriCloud