[cfe-commits] r134946 - in /cfe/trunk: lib/CodeGen/TargetInfo.cpp test/CodeGen/x86_64-arguments.c

Benjamin Kramer benny.kra at googlemail.com
Tue Jul 12 13:26:58 PDT 2011


On Mon, Jul 11, 2011 at 17:30, Bruno Cardoso Lopes
<bruno.cardoso at gmail.com> wrote:
> Author: bruno
> Date: Mon Jul 11 19:30:27 2011
> New Revision: 134946
>
> URL: http://llvm.org/viewvc/llvm-project?rev=134946&view=rev
> Log:
> Fix one x86_64 abi issue and the test to actually look for the right thing,
> which is: { <4 x float>, <4 x float> } should continue to go through memory.
>
> Modified:
>    cfe/trunk/lib/CodeGen/TargetInfo.cpp
>    cfe/trunk/test/CodeGen/x86_64-arguments.c
>
> Modified: cfe/trunk/lib/CodeGen/TargetInfo.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/TargetInfo.cpp?rev=134946&r1=134945&r2=134946&view=diff
> ==============================================================================
> --- cfe/trunk/lib/CodeGen/TargetInfo.cpp (original)
> +++ cfe/trunk/lib/CodeGen/TargetInfo.cpp Mon Jul 11 19:30:27 2011
> @@ -1228,6 +1228,13 @@
>
>     const RecordDecl *RD = RT->getDecl();
>
> +    // The only case a 256-bit wide vector could be used is when the struct
> +    // contains a single 256-bit element. Since Lo and Hi logic isn't extended
> +    // to work for sizes wider than 128, early check and fallback to memory.
> +    RecordDecl::field_iterator FirstElt = RD->field_begin();
> +    if (Size > 128 && getContext().getTypeSize(FirstElt->getType()) != 256)
> +      return;
> +
>     // Assume variable sized types are passed in memory.
>     if (RD->hasFlexibleArrayMember())
>       return;
> @@ -1263,7 +1270,7 @@
>
>     // Classify the fields one at a time, merging the results.
>     unsigned idx = 0;
> -    for (RecordDecl::field_iterator i = RD->field_begin(), e = RD->field_end();
> +    for (RecordDecl::field_iterator i = FirstElt, e = RD->field_end();
>            i != e; ++i, ++idx) {
>       uint64_t Offset = OffsetBase + Layout.getFieldOffset(idx);
>       bool BitField = i->isBitField();
>
> Modified: cfe/trunk/test/CodeGen/x86_64-arguments.c
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/x86_64-arguments.c?rev=134946&r1=134945&r2=134946&view=diff
> ==============================================================================
> --- cfe/trunk/test/CodeGen/x86_64-arguments.c (original)
> +++ cfe/trunk/test/CodeGen/x86_64-arguments.c Mon Jul 11 19:30:27 2011
> @@ -280,9 +280,9 @@
>  // Make sure that the struct below is passed in the same way
>  // regardless of avx being used
>  //
> -// CHECK: define void @func41(<2 x double> %s.coerce)
> +// CHECK: declare void @func40(%struct.t128* byval align 16)
>  typedef float __m128 __attribute__ ((__vector_size__ (16)));
> -typedef struct {
> +typedef struct t128 {
>   __m128 m;
>   __m128 n;
>  } two128;


Hi Bruno,

Looks like this change broke selfhost on x86_64, here's a test case:

// RUN: %clang_cc1 -emit-llvm-only -triple x86_64-unknown-unknow %s
class A {
  char big[17];
};

class B : public A { };

void foo(B b);
void bar() {
  B b;
  foo(b);
}




More information about the cfe-commits mailing list