Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk.

Richard.

2019-01-15  Richard Biener  <rguent...@suse.de>

        PR tree-optimization/88855
        * tree-if-conv.c (combine_blocks): Collect
        SSA_NAME_OCCURS_IN_ABNORMAL_PHI from propagated out virtuals.

        * gcc.dg/pr88855.c: New testcase.

Index: gcc/tree-if-conv.c
===================================================================
--- gcc/tree-if-conv.c  (revision 267930)
+++ gcc/tree-if-conv.c  (working copy)
@@ -2633,6 +2633,8 @@ combine_blocks (struct loop *loop)
              FOR_EACH_IMM_USE_ON_STMT (use_p, iter)
                SET_USE (use_p, last_vdef);
            }
+         if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (gimple_phi_result (vphi)))
+           SSA_NAME_OCCURS_IN_ABNORMAL_PHI (last_vdef) = 1;
          gsi = gsi_for_stmt (vphi); 
          remove_phi_node (&gsi, true);
        }
@@ -2691,6 +2693,8 @@ combine_blocks (struct loop *loop)
              FOR_EACH_IMM_USE_ON_STMT (use_p, iter)
                SET_USE (use_p, last_vdef);
            }
+         if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (gimple_phi_result (vphi)))
+           SSA_NAME_OCCURS_IN_ABNORMAL_PHI (last_vdef) = 1;
          gimple_stmt_iterator gsi = gsi_for_stmt (vphi); 
          remove_phi_node (&gsi, true);
        }
Index: gcc/testsuite/gcc.dg/pr88855.c
===================================================================
--- gcc/testsuite/gcc.dg/pr88855.c      (nonexistent)
+++ gcc/testsuite/gcc.dg/pr88855.c      (working copy)
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-O -ftree-loop-if-convert -ftree-vrp -fno-tree-copy-prop 
-fno-tree-dce -fno-tree-dominator-opts" } */
+
+typedef int jmp_buf[1];
+
+extern void exit(int) __attribute__((__noreturn__));
+extern int setjmpx(jmp_buf) __attribute__((__returns_twice__));
+
+jmp_buf jbAnagram;
+int a[6];
+int d;
+int b () { exit (1); }
+int c () { b (); }
+int e ()
+{
+  int f = 0;
+  for (; f < 6; f++)
+    a[f] = d;
+  c ();
+  setjmpx (jbAnagram);
+}

Reply via email to