]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR tree-optimization/46107 (-ftree-loop-distribute-patterns caused verif...
authorJakub Jelinek <jakub@redhat.com>
Fri, 12 Nov 2010 11:28:32 +0000 (12:28 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 12 Nov 2010 11:28:32 +0000 (12:28 +0100)
Backport from mainline
2010-11-03  Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/46107
* cfgloopmanip.c (loop_version): Set irred_flag back into entry->flags
if cfg_hook_duplicate_loop_to_header_edge failed.

* gcc.c-torture/compile/pr46107.c: New test.

From-SVN: r166649

gcc/ChangeLog
gcc/cfgloopmanip.c
gcc/gimplify.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/pr46107.c [new file with mode: 0644]

index 8c766dea7bb5dc7341c3a3b1038c75b22762c445..bd022e95b4ae3cb90fa2bd1922398e42baf8e0e2 100644 (file)
@@ -1,3 +1,12 @@
+2010-11-12  Jakub Jelinek  <jakub@redhat.com>
+
+       Backport from mainline
+       2010-11-03  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/46107
+       * cfgloopmanip.c (loop_version): Set irred_flag back into entry->flags
+       if cfg_hook_duplicate_loop_to_header_edge failed.
+
 2010-11-10  Uros Bizjak  <ubizjak@gmail.com>
 
        PR middle-end/46419
index 28cfa3cfc9aabb33e565d618f9407ed52401e6c4..267eb8f183c3340697d1aabeda24f180f2c488a8 100644 (file)
@@ -1546,7 +1546,10 @@ loop_version (struct loop *loop,
   /* Duplicate loop.  */
   if (!cfg_hook_duplicate_loop_to_header_edge (loop, entry, 1,
                                               NULL, NULL, NULL, 0))
-    return NULL;
+    {
+      entry->flags |= irred_flag;
+      return NULL;
+    }
 
   /* After duplication entry edge now points to new loop head block.
      Note down new head as second_head.  */
index ea4f26d54569a5d009ac93101725b1969e9f4969..94bae9c83f2c1c991f44f6b22d1afb5ad87b1148 100644 (file)
@@ -4842,6 +4842,13 @@ gimplify_asm_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p)
       /* If the operand is a memory input, it should be an lvalue.  */
       if (!allows_reg && allows_mem)
        {
+         tree inputv = TREE_VALUE (link);
+         STRIP_NOPS (inputv);
+         if (TREE_CODE (inputv) == PREDECREMENT_EXPR
+             || TREE_CODE (inputv) == PREINCREMENT_EXPR
+             || TREE_CODE (inputv) == POSTDECREMENT_EXPR
+             || TREE_CODE (inputv) == POSTINCREMENT_EXPR)
+           TREE_VALUE (link) = error_mark_node;
          tret = gimplify_expr (&TREE_VALUE (link), pre_p, post_p,
                                is_gimple_lvalue, fb_lvalue | fb_mayfail);
          mark_addressable (TREE_VALUE (link));
index 12da78f95b13c118e14233f08a0eba87433a4da7..be2b2c0ea0a418adc0f32fdf26faf6eb411e204c 100644 (file)
@@ -1,3 +1,11 @@
+2010-11-12  Jakub Jelinek  <jakub@redhat.com>
+
+       Backport from mainline
+       2010-11-03  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/46107
+       * gcc.c-torture/compile/pr46107.c: New test.
+
 2010-11-10  Uros Bizjak  <ubizjak@gmail.com>
 
        PR target/46419
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr46107.c b/gcc/testsuite/gcc.c-torture/compile/pr46107.c
new file mode 100644 (file)
index 0000000..41582b8
--- /dev/null
@@ -0,0 +1,16 @@
+/* PR tree-optimization/46107 */
+
+int foo (void) __attribute__ ((noreturn));
+
+void
+bar (int x, int *y, int z)
+{
+  static void *j[] = { &&l1, &&l2 };
+l1:
+  if (*y)
+    goto *j[z];
+  foo ();
+l2:
+  *y ^= (x & 1) ? -1 : 0;
+  goto *j[x];
+}