Fix processing of ADDR_EXPR in get_expr_operands
Diego Novillo
dnovillo@redhat.com
Fri Jul 30 15:44:00 GMT 2004
On Thu, 2004-07-29 at 22:38, Richard Kenner wrote:
> Invariant addresses are supposed to be marked with TREE_INVARIANT, not
> TREE_CONSTANT. That's what I've been told by the FE folks and that's
> why the tree optimizers almost always rely on
> is_gimple_min_invariant().
>
> What does this have to do with the volatile question I'm asking about?
>
It's rather obvious. You cannot rely on TREE_CONSTANT to determine
constness of ADDR_EXPRs.
I don't know *why* ADDR_EXPR of a volatile is not TREE_CONSTANT. I
don't really care. All I know, and always use, is that constness of
ADDR_EXPRs is tested with TREE_INVARIANT. Hence the call to
is_gimple_min_invariant. Even TREE_CONSTANT is not always right, you
have to check for overflow as well.
> these flags on ADDR_EXPRs and they would be blown away by the middle-end
> if it did. They are set by recompute_tree_invarant_for_addr_expr.
>
Which you will notice sets both TREE_CONSTANT and TREE_INVARIANT, not
necessarily with the same value.
Diego.
More information about the Gcc-patches
mailing list