On Thu, Feb 07, 2019 at 04:02:54PM +0100, Jakub Jelinek wrote:
> Another month have passed since my last 8.x backporting effort,
> thus I've backported following 32 patches from trunk to 8.x,
> bootstrapped/regtested on x86_64-linux and i686-linux and committed.

And two further ones now, bootstrapped/regtested on powerpc64{,le}-linux
and committed.

        Jakub
2019-02-09  Jakub Jelinek  <ja...@redhat.com>

        PR middle-end/89243
        * g++.dg/opt/pr89188.C: Include ../torture/pr88861.C.

        Backported from mainline
        2019-01-16  David Malcolm  <dmalc...@redhat.com>

        PR target/88861
        * combine.c (delete_noop_moves): Convert to "bool" return,
        returning true if any edges are eliminated.
        (combine_instructions): Also return true if delete_noop_moves
        returns true.

        * g++.dg/torture/pr88861.C: New test.

--- gcc/combine.c       (revision 267983)
+++ gcc/combine.c       (revision 267984)
@@ -983,14 +983,17 @@ combine_validate_cost (rtx_insn *i0, rtx
 }
 
 
-/* Delete any insns that copy a register to itself.  */
+/* Delete any insns that copy a register to itself.
+   Return true if the CFG was changed.  */
 
-static void
+static bool
 delete_noop_moves (void)
 {
   rtx_insn *insn, *next;
   basic_block bb;
 
+  bool edges_deleted = false;
+
   FOR_EACH_BB_FN (bb, cfun)
     {
       for (insn = BB_HEAD (bb); insn != NEXT_INSN (BB_END (bb)); insn = next)
@@ -1001,10 +1004,12 @@ delete_noop_moves (void)
              if (dump_file)
                fprintf (dump_file, "deleting noop move %d\n", INSN_UID (insn));
 
-             delete_insn_and_edges (insn);
+             edges_deleted |= delete_insn_and_edges (insn);
            }
        }
     }
+
+  return edges_deleted;
 }
 
 
@@ -1143,8 +1148,8 @@ insn_a_feeds_b (rtx_insn *a, rtx_insn *b
 /* Main entry point for combiner.  F is the first insn of the function.
    NREGS is the first unused pseudo-reg number.
 
-   Return nonzero if the combiner has turned an indirect jump
-   instruction into a direct jump.  */
+   Return nonzero if the CFG was changed (e.g. if the combiner has
+   turned an indirect jump instruction into a direct jump).  */
 static int
 combine_instructions (rtx_insn *f, unsigned int nregs)
 {
@@ -1529,7 +1534,7 @@ retry:
   default_rtl_profile ();
   clear_bb_flags ();
   new_direct_jump_p |= purge_all_dead_edges ();
-  delete_noop_moves ();
+  new_direct_jump_p |= delete_noop_moves ();
 
   /* Clean up.  */
   obstack_free (&insn_link_obstack, NULL);
--- gcc/testsuite/g++.dg/torture/pr88861.C      (nonexistent)
+++ gcc/testsuite/g++.dg/torture/pr88861.C      (revision 267984)
@@ -0,0 +1,11 @@
+// { dg-options "-fnon-call-exceptions" }
+
+struct Ax {
+  int n, a[];
+};
+
+int i = 12345678;
+int main() {
+  static Ax s{456, i};
+  ((s.a[0]) ? (void)0 : (void)0);
+}
--- gcc/testsuite/g++.dg/opt/pr89188.C  2019-02-07 15:55:14.595876158 +0100
+++ gcc/testsuite/g++.dg/opt/pr89188.C  2019-02-08 19:37:02.497288425 +0100
@@ -2,12 +2,4 @@
 // { dg-do compile { target c++11 } }
 // { dg-options "-Og -flive-range-shrinkage -fnon-call-exceptions" }
 
-struct Ax {
-  int n, a[];
-};
-
-int i = 12345678;
-int main() {
-  static Ax s{456, i};
-  ((s.a[0]) ? (void)0 : (void)0);
-}
+#include "../torture/pr88861.C"
2019-02-09  Jakub Jelinek  <ja...@redhat.com>

        Backported from mainline
        2019-02-08  Jakub Jelinek  <ja...@redhat.com>

        PR rtl-optimization/89234
        * except.c (copy_reg_eh_region_note_forward): Return if note_or_insn
        is a NOTE, CODE_LABEL etc. - rtx_insn * other than INSN_P.
        (copy_reg_eh_region_note_backward): Likewise.

        * g++.dg/ubsan/pr89234.C: New test.

--- gcc/except.c        (revision 268668)
+++ gcc/except.c        (revision 268669)
@@ -1756,6 +1756,8 @@ copy_reg_eh_region_note_forward (rtx not
       if (note == NULL)
        return;
     }
+  else if (is_a <rtx_insn *> (note_or_insn))
+    return;
   note = XEXP (note, 0);
 
   for (insn = first; insn != last ; insn = NEXT_INSN (insn))
@@ -1778,6 +1780,8 @@ copy_reg_eh_region_note_backward (rtx no
       if (note == NULL)
        return;
     }
+  else if (is_a <rtx_insn *> (note_or_insn))
+    return;
   note = XEXP (note, 0);
 
   for (insn = last; insn != first; insn = PREV_INSN (insn))
--- gcc/testsuite/g++.dg/ubsan/pr89234.C        (nonexistent)
+++ gcc/testsuite/g++.dg/ubsan/pr89234.C        (revision 268669)
@@ -0,0 +1,11 @@
+// PR rtl-optimization/89234
+// { dg-do compile { target dfp } }
+// { dg-options "-O2 -fnon-call-exceptions -fsanitize=null" }
+
+typedef float __attribute__((mode (SD))) _Decimal32;
+
+void
+foo (_Decimal32 *b, _Decimal32 c)
+{
+  *b = c + 1.5;
+}

Reply via email to