This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH]: alignment analysis, take 3
- From: Richard Henderson <rth at redhat dot com>
- To: Daniel Berlin <dberlin at dberlin dot org>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 27 Apr 2005 10:44:44 -0700
- Subject: Re: [PATCH]: alignment analysis, take 3
- References: <1114621911.1324.3.camel@linux-009002219096.watson.ibm.com>
On Wed, Apr 27, 2005 at 01:11:51PM -0400, Daniel Berlin wrote:
> + else if (TREE_CODE (rhs) == ADDR_EXPR
> + && DECL_P (TREE_OPERAND (rhs, 0)))
> + {
> + val = get_decl_alignment (TREE_OPERAND (rhs, 0));
This usage is ok.
> + if (TREE_CODE (op1) == SSA_NAME && POINTER_TYPE_P (TREE_TYPE (op1)))
> + op1val = get_value (op1);
> + else if (DECL_P (op1) && POINTER_TYPE_P (TREE_TYPE (op1)))
> + {
> + temp = get_decl_alignment (op1);
This one isn't. Again you're applying the alignment of the pointer
to the alignment of the object.
> + if (TREE_CODE (op2) == INTEGER_CST)
> + newoffset = TREE_INT_CST_LOW (op2);
> + if (op1val == NULL
> + || newoffset == 0 || (op1val && op1val->lattice_val == UNDEFINED))
> + {
> + val.lattice_val = KNOWN;
> + val.alignment.n = BITS_PER_UNIT;
> + val.alignment.offset = 0;
This is confused wrt constants. Further, any time you find yourself
wanting to fall back to BITS_PER_UNIT is when you should use the
get_default_value code.
> + val.alignment.offset = ((val.alignment.offset +
> + BITS_PER_UNIT * newoffset)
> + % val.alignment.n);
Doesn't handle MINUS_EXPR properly.
r~