This is the mail archive of the 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] Fix PR tree-optimization/32589

On 7/10/07, Eric Botcazou <> wrote:

This is the Ada bootstrap failure on 32-bit platforms, see

To recap, FRE may create non-GIMPLE expressions that are nevertheless accepted
by the predicates in tree-gimple.c, so they cannot be re-gimplified later by
the existing mechanisms.

As suggested by Diego, a first approach would be to create is_gimple_const and
use it instead of is_gimple_[min_]invariant when it makes sense to do so.
The problem, as I found out when trying to implement it, is the last part of
the previous sentence: IMHO it is not clear at all when is_gimple_const
should be used instead of is_gimple_[min_]invariant in the tree optimizers.
I don't have the big picture here so I cannot really formulate anything.

The second approach is described in passes.c:

  /* Note that the folders should only create gimple expressions.
     This is a hack until the new folder is ready.  */
  in_gimple_form = (cfun && (cfun->curr_properties & PROP_trees)) != 0;

and is of course much more straightforward, hence the proposed patch.

Bootstrapped/regtested on i586-suse-linux, but the Ada library cannot be built
because of another problem in tree-ssa-sccvn.c (PR tree-opt/32713).

OK for mainline?

I think this is the wrong approach. Instead restricting what we accept as is_gimple_min_invariant should be fixed. Or FRE should do what other passes do and use set_rhs () to verify if the resulting trees are sufficiently gimple (I realize it tries to just re-gimplify, but that doesn't work as the gimplifier is using the (broken) is_gimple_min_invariant predicate as well).

What happens if you restrict is_gimple_min_invariant like with

Index: tree-gimple.c
--- tree-gimple.c       (revision 126488)
+++ tree-gimple.c       (working copy)
@@ -175,7 +175,8 @@ is_gimple_min_invariant (tree t)
  switch (TREE_CODE (t))
    case ADDR_EXPR:
-      return TREE_INVARIANT (t);
+      return (is_gimple_id (TREE_OPERAND (t, 0))
+             && TREE_INVARIANT (t));

    case INTEGER_CST:
    case REAL_CST:

this should still allow the interesting cases.


2007-07-10 Eric Botcazou <>

        PR tree-optimization/32589
        * (fold-const.o): Add dependency on TREE_GIMPLE_H.
        * fold-const.c: Include tree-gimple.h.
        (try_move_mult_to_index): If in GIMPLE form, do not synthesize
        non-GIMPLE index.
        * tree-gimple.c (is_gimple_min_invariant): Clarify head comment.
        * doc/tree-ssa.texi (Rough GIMPLE Grammar): Add missing rule.

-- Eric Botcazou

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