[PATCH] D85543: Limit Max Vector alignment on COFF targets to 8192

Erich Keane via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 12 06:35:54 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rGaa4bc1cb7978: Limit Max Vector alignment on COFF targets to 8192. (authored by erichkeane).
Herald added a project: clang.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D85543/new/

https://reviews.llvm.org/D85543

Files:
  clang/include/clang/Basic/TargetInfo.h
  clang/lib/Basic/Targets/X86.h
  clang/test/CodeGen/alignment.c


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
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/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; }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85543.285065.patch
Type: text/x-patch
Size: 2760 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200812/8b9698e8/attachment-0001.bin>


More information about the cfe-commits mailing list