[llvm-commits] [PATCH] va_arg alignment type

David Meyer pdox at google.com
Thu Oct 14 09:41:25 PDT 2010


That's not what I was expecting.

If that is what is expected, then it seems that <2 x i64> should have
16-byte stack alignment.

This might be a bug with getCallFrameTypeAlignment(), or perhaps the
DataLayout?

- David M


On Thu, Oct 14, 2010 at 7:53 AM, Rafael Espindola <espindola at google.com>wrote:

> On 13 October 2010 22:21, David Meyer <pdox at google.com> wrote:
> > Rafael,
> > I'm afraid not. <2 x i64> is aligned to 8-bytes on X86-64, both ABI and
> > stack.
> > I'm not sure there's any way to "test" this change... it may have no
> > external effects (except for Native Client). All major architectures have
> > stack alignment the same as ABI alignment. In principle, however, I think
> > this change is correct.
>
> I tested
>
> define <2 x i64> @test(i32 %a, i32 %b, ...) nounwind optsize {
> entry:
>  %ap = alloca i8*, align 4                       ; <i8**> [#uses=3]
>  %ap1 = bitcast i8** %ap to i8*                  ; <i8*> [#uses=2]
>  call void @llvm.va_start(i8* %ap1)
>  %0 = va_arg i8** %ap, i32                       ; <i32> [#uses=0]
>  %1 = va_arg i8** %ap,  <2 x i64>                    ; <double> [#uses=1]
>  call void @llvm.va_end(i8* %ap1)
>  ret  <2 x i64> %1
> }
> declare void @llvm.va_start(i8*) nounwind
> declare void @llvm.va_end(i8*) nounwind
>
> With and without your patch. Without your patch there is an extra
>
>        addq    $15, %rcx
>        andq    $-16, %rcx
>
> in the output. So it is really reducing the alignment requirement of
> <2 x i64>. I think but I am not sure that this is a fix and not a
> regression :-)
>
> So, is this what you were expecting?
>
> > - David M
>
> Cheers,
> --
> Rafael Ávila de Espíndola
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20101014/f5b868d0/attachment.html>


More information about the llvm-commits mailing list