This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH, tree-optimization]: Fix PR tree-optimization/33920, [4.3 Regression] Segfault in combine_blocks/tree-if-conv.c


Uros Bizjak wrote:

When SSA diamond degenerates into:

    11
    | \
    |  \
    |   12
    |  /
    | /
    13

then bb 11 is not required to have a condition predicate set in its
bb->aux field.

This is not quite what is happening. The diamond is not degenerating,
the problem is that the predicate is in block 10, and the presence of
the user label in block 11 prevents us from merging the two blocks,
that's why block 11 needs no conditional predicate.

No, we _do_ copy predicate from bb 10 (the code around line 190). The problem is, that the predicate in bb 10 (single predecessor above bb 11) is null, since bb 10 happens to be loop header,


Perhaps we should force null predicates of loop headers to "true"?

Attached patch sets predicate of single successor block to "true" when predecessor block has NULL predicate. Since the single successor bb will always be executed, it should either inherit the predicate from its predecessor bb or set its predicate to true.


Patch was bootstrapped and regression tested on x86_64-pc-linux-gnu {,-m32}.

2007-10-28 Uros Bizjak <ubizjak@gmail.com>

       PR tree-optimization/33920
       * tree-if-conv.c (tree_if_conversion): Force predicate of single
       successor bb to true when predecessor bb has NULL predicate.

testsuite/ChangeLog:

2007-10-28  Martin Michlmayr  <tbm@cyrius.com>
           Uros Bizjak  <ubizjak@gmail.com>

       PR tree-optimization/33920
       * gcc.dg/tree-ssa/pr33290.c: New test.

Uros.

Index: tree-if-conv.c
===================================================================
--- tree-if-conv.c      (revision 129691)
+++ tree-if-conv.c      (working copy)
@@ -189,8 +189,14 @@ tree_if_conversion (struct loop *loop, b
      if (single_succ_p (bb))
       {
         basic_block bb_n = single_succ (bb);
-         if (cond != NULL_TREE)
-           add_to_predicate_list (bb_n, cond);
+
+         /* Successor bb inherits predicate of its predecessor. If there
+            is no predicate in predecessor bb, then consider successor bb
+            as always executed.  */
+         if (cond == NULL_TREE)
+           cond = boolean_true_node;
+
+         add_to_predicate_list (bb_n, cond);
       }
    }




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]