On Tue, 7 Jan 2014, Jakub Jelinek wrote:

> On Tue, Jan 07, 2014 at 04:12:57PM +0100, Richard Biener wrote:
> > > What about if something post gimplification creates VCE(BFR(VCE())) or
> > > similar and tries to force_gimple_operand_gsi or similar, then without
> > > making the above invalid in the predicates we'd still not try to gimplify 
> > > it
> > > at all (because it would pass the predicate), and then hit the 
> > > verification
> > > ICE.
> > 
> > I don't think it passes any predicate, certainly not is_gimple_val,
> > so we enter gimplification anyway.  Or am I missing something?
> 
> It isn't is_gimple_val, sure, I was thinking about whatever predicate we
> have for say the RHS of a load, is that is_gimple_addressable?  There is
> is_gimple_lvalue too.  Apparently we are calling force_gimple_operand_1*
> with just is_gimple_condexpr if it is not is_gimple_val or
> is_gimple_reg_rhs, so perhaps we are fine.

I think it's fine.  We do

tree
force_gimple_operand_1 (tree expr, gimple_seq *stmts,
                        gimple_predicate gimple_test_f, tree var)
{
...
  /* gimple_test_f might be more strict than is_gimple_val, make
     sure we pass both.  Just checking gimple_test_f doesn't work
     because most gimple predicates do not work recursively.  */
  if (is_gimple_val (expr)
      && (*gimple_test_f) (expr))
    return expr;

which of course is kind of pointless, but the gimplifier predicates
are designed to only work post-gimplification, not pre-gimplification
(if you test for the predicate at the start of gimplify_expr you'll
see lots of failures).

I have now committed the patch.

Richard.

Reply via email to