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 PR35607, another revenge of invariant addresses (ivopts)


On Mon, Mar 17, 2008 at 2:39 PM, Zdenek Dvorak <rakdver@kam.mff.cuni.cz> wrote:
> Hi,
>
>
>  > > Yes.  address_invariant_p should be simply
>  >
>  > Like that one.
>  >
>  > Can we rely on TREE_INVARIANT on the base object of the reference
>  > tree or shall we open-code that as well (hm, I wasn't able to
>  > quickly come up with the correct thing here ;)).
>  >
>  > +   return TREE_INVARIANT (op);
>
>  return CONSTANT_CLASS_P (op) || DECL_P (op);

Actually recompute_tree_invariant_for_addr_expr uses the equivalent of

  if (DECL_P (op)
      && (staticp (op)
          || decl_function_context (op) == current_function_decl
          || (TREE_CODE (op) == VAR_DECL
              && DECL_THREAD_LOCAL_P (op))))
    return true;

  return CONSTANT_CLASS_P (op);

so not all DECLs are invariant in the old sense.  Though I don't see
why we shouldn't allow arbitrary DECLs here...

Richard.


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