[LLVMdev] RFC: llvm-convert.cpp Patch
Dale Johannesen
dalej at apple.com
Tue Nov 6 18:07:07 PST 2007
On Nov 6, 2007, at 5:45 PM, Bill Wendling wrote:
> $ more testcase.c.t03.generic
> Qux ()
> {
> static char C.0[11] = {0};
> char Bar[11];
>
> Bar = C.0;
> }
>
> Anyway, it turns out that the gimplifier was generating the correct
> alignment, but it was being overridden in assemble_variable():
>
> /* On some machines, it is good to increase alignment sometimes. */
> if (! DECL_USER_ALIGN (decl))
> {
> #ifdef DATA_ALIGNMENT
> align = DATA_ALIGNMENT (TREE_TYPE (decl), align);
> #endif
> #ifdef CONSTANT_ALIGNMENT
> => if (DECL_INITIAL (decl) != 0 && DECL_INITIAL (decl) !=
> error_mark_node)
> align = CONSTANT_ALIGNMENT (DECL_INITIAL (decl), align);
> #endif
> }
Not sure I'm getting it, is this Bar itself or the constructed C.0
that's getting realigned?
> By setting the DECL_USER_ALIGN field, we can get the correct
> alignment.
>
> Comments?
>
> -bw
>
> Index: gimplify.c
> ===================================================================
> --- gimplify.c (revision 43658)
> +++ gimplify.c (working copy)
> @@ -2756,7 +2756,8 @@
> TREE_STATIC (new) = 1;
> TREE_READONLY (new) = 1;
> DECL_INITIAL (new) = ctor;
> - if (align > DECL_ALIGN (new))
> + /* LLVM LOCAL - Set DECL_USER_ALIGN when equal */
> + if (align >= DECL_ALIGN (new))
> {
> DECL_ALIGN (new) = align;
> DECL_USER_ALIGN (new) = 1;
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
More information about the llvm-dev
mailing list