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] Fix loop optimization bug


> Oh, I see.  Well, the only addressable ones after that
> test are is_gimple_var () || handled_component_p.
> IMHO we better return true for anything else.

Agreed.  Something like this?

static bool
may_be_nonaddressable_p (tree expr)
{
  enum tree_code code = TREE_CODE (expr);

  switch (code)
    {
    case TARGET_MEM_REF:
      /* TARGET_MEM_REFs are translated directly to valid MEMs on the
	 target, thus they are always addressable.  */
      return false;

    case COMPONENT_REF:
      if (DECL_NONADDRESSABLE_P (TREE_OPERAND (expr, 1)))
	return true;

    /* ... fall through ... */

    case ARRAY_REF:
    case ARRAY_RANGE_REF:
    case VIEW_CONVERT_EXPR:
    case REALPART_EXPR:
    case IMAGPART_EXPR:
      return may_be_nonaddressable_p (TREE_OPERAND (expr, 0));

    default:
      if (is_gimple_variable (expr))
	return false;
      break;
    }

  /* Everything else is something we can't take the address of.  */
  return true;
}

-- 
Eric Botcazou


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