This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, PR50527] Don't assume alignment of vla-related allocas.
- From: Richard Henderson <rth at redhat dot com>
- To: Tom de Vries <Tom_deVries at mentor dot com>
- Cc: Richard Guenther <richard dot guenther at gmail dot com>, "gcc-patches >> \"gcc-patches at gcc dot gnu dot org\"" <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 04 Oct 2011 11:51:31 -0700
- Subject: Re: [PATCH, PR50527] Don't assume alignment of vla-related allocas.
- References: <4E82EA3E.4050000@mentor.com> <CAFiYyc1pjDPwZS3-yp+xN7+PPZoQdD9FWAGs2LZ8kxzCvFAtDQ@mail.gmail.com> <4E846F6F.7070002@mentor.com> <CAFiYyc2oW-=1sUqXYtYtPBAcNYjYbf-Edix2ES18BdNW2TwbOg@mail.gmail.com> <4E8735DD.5010701@mentor.com> <4E8AB925.8010305@mentor.com> <CAFiYyc1HiTckQ83jE41xAekjDUO_qhCmsxoeA-NX-=s8rUX70w@mail.gmail.com> <4E8B344A.7010502@mentor.com>
On 10/04/2011 09:28 AM, Tom de Vries wrote:
> Well, that was the idea. But now I wonder, isn't it better to do this in
> expand_builtin_alloca:
> ...
> /* Compute the argument. */
> op0 = expand_normal (CALL_EXPR_ARG (exp, 0));
>
> + align =
> + (DECL_FUNCTION_CODE (get_callee_fndecl (exp)) ==
> + BUILT_IN_ALLOCA_WITH_ALIGN)
> + ? TREE_INT_CST_LOW (CALL_EXPR_ARG (exp, 1))
> + : BIGGEST_ALIGNMENT;
> +
> +
> /* Allocate the desired space. */
> - result = allocate_dynamic_stack_space (op0, 0, BIGGEST_ALIGNMENT,
> - cannot_accumulate);
> + result = allocate_dynamic_stack_space (op0, 0, align, cannot_accumulate);
Yes, this is better.
I've lost track of what you're trying to do with "folding" alloca?
r~