Index: clang/include/clang/Basic/TargetInfo.h =================================================================== --- clang/include/clang/Basic/TargetInfo.h +++ clang/include/clang/Basic/TargetInfo.h @@ -100,8 +100,8 @@ unsigned char MinGlobalAlign; unsigned short NewAlign; - unsigned short MaxVectorAlign; - unsigned short MaxTLSAlign; + unsigned MaxVectorAlign; + unsigned MaxTLSAlign; const llvm::fltSemantics *HalfFormat, *BFloat16Format, *FloatFormat, *DoubleFormat, *LongDoubleFormat, *Float128Format; @@ -1271,9 +1271,7 @@ /// /// Gets the maximum alignment (in bits) of a TLS variable on this target. /// Returns zero if there is no such constraint. - unsigned short getMaxTLSAlign() const { - return MaxTLSAlign; - } + unsigned getMaxTLSAlign() const { return MaxTLSAlign; } /// Whether target supports variable-length arrays. bool isVLASupported() const { return VLASupported; } Index: clang/lib/Basic/Targets/X86.h =================================================================== --- clang/lib/Basic/Targets/X86.h +++ clang/lib/Basic/Targets/X86.h @@ -144,6 +144,11 @@ LongDoubleFormat = &llvm::APFloat::x87DoubleExtended(); AddrSpaceMap = &X86AddrSpaceMap; HasStrictFP = true; + + bool IsWinCOFF = + getTriple().isOSWindows() && getTriple().isOSBinFormatCOFF(); + if (IsWinCOFF) + MaxVectorAlign = MaxTLSAlign = 8192u * getCharWidth(); } const char *getLongDoubleMangling() const override { Index: clang/test/CodeGen/alignment.c =================================================================== --- clang/test/CodeGen/alignment.c +++ clang/test/CodeGen/alignment.c @@ -1,4 +1,5 @@ -// RUN: %clang_cc1 -triple i386-unknown-linux-gnu -emit-llvm %s -o - | FileCheck %s +// RUN: %clang_cc1 -triple i386-unknown-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefixes=CHECK,NONCOFF +// RUN: %clang_cc1 -triple i386-unknown-windows-pc -emit-llvm %s -o - | FileCheck %s --check-prefixes=CHECK,COFF __attribute((aligned(16))) float a[128]; union {int a[4]; __attribute((aligned(16))) float b[4];} b; @@ -7,7 +8,7 @@ // CHECK: @b = {{.*}}zeroinitializer, align 16 long long int test5[1024]; -// CHECK-DAG: @test5 = global [1024 x i64] zeroinitializer, align 8 +// CHECK-DAG: @test5 = {{.*}}global [1024 x i64] zeroinitializer, align 8 // PR5279 - Reduced alignment on typedef. typedef int myint __attribute__((aligned(1))); @@ -67,3 +68,11 @@ } // CHECK-LABEL: @test6 // CHECK: load <4 x float>, <4 x float>* {{.*}}, align 2 + +typedef int __attribute__((ext_vector_type(200 * 16))) BigVecTy; +void test7() { + BigVecTy V; +} +// CHECK-LABEL: @test7 +// NONCOFF: alloca <3200 x i32>, align 16384 +// COFF: alloca <3200 x i32>, align 8192