]> gcc.gnu.org Git - gcc.git/commitdiff
re PR tree-optimization/34140 (ICE in is_hidden_global_store, at tree-ssa-sink.c...
authorJakub Jelinek <jakub@redhat.com>
Wed, 28 Nov 2007 19:48:19 +0000 (20:48 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 28 Nov 2007 19:48:19 +0000 (20:48 +0100)
PR tree-optimization/34140
* tree-if-conv.c (if_convertible_phi_p): Fail if BB other than
loop->header has virtual phi nodes.

* gcc.c-torture/compile/20071128-1.c: New test.

From-SVN: r130494

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/20071128-1.c [new file with mode: 0644]
gcc/tree-if-conv.c

index 34f345377c5841ff4c1d895759696cf48e95831e..c57bc494f9f0b959f95f7f83b23f54cdb0850721 100644 (file)
@@ -1,3 +1,9 @@
+2007-11-28  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/34140
+       * tree-if-conv.c (if_convertible_phi_p): Fail if BB other than
+       loop->header has virtual phi nodes.
+
 2007-11-28  Richard Sandiford  <rsandifo@nildram.co.uk>
 
        PR target/32406
index b8ee3a3a7da855442b48895b33c147e4ab1274d0..b1a58b8667cff4881c7b83ed6c99af9375c4e7e5 100644 (file)
@@ -1,3 +1,8 @@
+2007-11-28  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/34140
+       * gcc.c-torture/compile/20071128-1.c: New test.
+
 2007-11-27  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
 
        PR fortran/32928
diff --git a/gcc/testsuite/gcc.c-torture/compile/20071128-1.c b/gcc/testsuite/gcc.c-torture/compile/20071128-1.c
new file mode 100644 (file)
index 0000000..14b3f93
--- /dev/null
@@ -0,0 +1,24 @@
+/* PR tree-optimization/34140 */
+/* Testcase by Martin Michlmayr <tbm@cyrius.com> */
+
+struct S
+{
+  unsigned int s;
+};
+struct T
+{
+  struct S t[2];
+  unsigned int u : 1;
+};
+
+void
+foo (int x, int y, int z)
+{
+  int i;
+  struct T t;
+
+  t.u = t.u;
+  for (i = 0; i < x; i++)
+    if (z != 1)
+      t.t[i].s = y || t.u;
+}
index 324fc93e1891a97a00692b935ff7109b81469279..ec349297fd109adc7cd9984b8ece7b3bc93d64fa 100644 (file)
@@ -302,7 +302,8 @@ tree_if_convert_cond_expr (struct loop *loop, tree stmt, tree cond,
    and it belongs to basic block BB.
    PHI is not if-convertible
    - if it has more than 2 arguments.
-   - Virtual PHI is immediately used in another PHI node.  */
+   - Virtual PHI is immediately used in another PHI node.
+   - Virtual PHI on BB other than header.  */
 
 static bool
 if_convertible_phi_p (struct loop *loop, basic_block bb, tree phi)
@@ -324,6 +325,13 @@ if_convertible_phi_p (struct loop *loop, basic_block bb, tree phi)
     {
       imm_use_iterator imm_iter;
       use_operand_p use_p;
+
+      if (bb != loop->header)
+       {
+         if (dump_file && (dump_flags & TDF_DETAILS))
+           fprintf (dump_file, "Virtual phi not on loop header.\n");
+         return false;
+       }
       FOR_EACH_IMM_USE_FAST (use_p, imm_iter, PHI_RESULT (phi))
        {
          if (TREE_CODE (USE_STMT (use_p)) == PHI_NODE)
This page took 0.140604 seconds and 5 git commands to generate.