On Wed, Dec 28, 2011 at 11:53:41AM -0800, Nathan Froyd wrote:
> ----- Original Message -----
> > else if (is_gimple_call (def_stmt))
> > {
> > + int flags = gimple_call_flags (def_stmt);
> > +
> > + /* Don't optimize away calls that have side-effects. */
> > + if ((flags & (ECF_CONST|ECF_PURE)) == 0
> > + || (flags & ECF_LOOPING_CONST_OR_PURE))
> 
> This patch does this computation twice; grepping through the tree for
> ECF_CONST suggests it's done quite a few more times.  Could we get a
> predicate in gimple.h to encapsulate this?

I think it would be an overkill to have a predicate for
nonlooping_const_or_pure_flags, we don't have predicates for similar
RTL or decl flags either.
We write:
        /* We can delete dead const or pure calls as long as they do not
         infinite loop.  */
      && (RTL_CONST_OR_PURE_CALL_P (insn)
          && !RTL_LOOPING_CONST_OR_PURE_CALL_P (insn)))
and not RTL_CONST_OR_PURE_NONLOOPING_CALL_P (insn) etc.

        Jakub

Reply via email to