r362186 - Revert "[X86] Fix i386 struct and union parameter alignment"

Pengfei Wang via cfe-commits cfe-commits at lists.llvm.org
Thu May 30 18:50:07 PDT 2019


Author: pengfei
Date: Thu May 30 18:50:07 2019
New Revision: 362186

URL: http://llvm.org/viewvc/llvm-project?rev=362186&view=rev
Log:
Revert "[X86] Fix i386 struct and union parameter alignment"

This reverts commit d61cb749f4ac2c90244906d756e80a5c4a7ffa89 (SVN:
361934).

According to James suggestion, revert this change. Please ref:
https://reviews.llvm.org/D60748

Removed:
    cfe/trunk/test/CodeGen/x86_32-align-linux.c
Modified:
    cfe/trunk/lib/CodeGen/TargetInfo.cpp
    cfe/trunk/test/CodeGen/x86_32-arguments-linux.c

Modified: cfe/trunk/lib/CodeGen/TargetInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/TargetInfo.cpp?rev=362186&r1=362185&r2=362186&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/TargetInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/TargetInfo.cpp Thu May 30 18:50:07 2019
@@ -1010,7 +1010,6 @@ class X86_32ABIInfo : public SwiftABIInf
   bool IsWin32StructABI;
   bool IsSoftFloatABI;
   bool IsMCUABI;
-  bool IsLinuxABI;
   unsigned DefaultNumRegisterParameters;
 
   static bool isRegisterSize(unsigned Size) {
@@ -1077,7 +1076,6 @@ public:
       IsWin32StructABI(Win32StructABI),
       IsSoftFloatABI(SoftFloatABI),
       IsMCUABI(CGT.getTarget().getTriple().isOSIAMCU()),
-      IsLinuxABI(CGT.getTarget().getTriple().isOSLinux()),
       DefaultNumRegisterParameters(NumRegisterParameters) {}
 
   bool shouldPassIndirectlyForSwift(ArrayRef<llvm::Type*> scalars,
@@ -1494,15 +1492,8 @@ unsigned X86_32ABIInfo::getTypeStackAlig
   if (Align <= MinABIStackAlignInBytes)
     return 0; // Use default alignment.
 
-  if (IsLinuxABI) {
-    // i386 System V ABI 2.1: Structures and unions assume the alignment of their
-    // most strictly aligned component.
-    //
-    // Exclude other System V OS (e.g Darwin, PS4 and FreeBSD) since we don't
-    // want to spend any effort dealing with the ramifications of ABI breaks.
-    return Align;
-  } else if (!IsDarwinVectorABI) {
-    // On non-Darwin and non-Linux, the stack type alignment is always 4.
+  // On non-Darwin, the stack type alignment is always 4.
+  if (!IsDarwinVectorABI) {
     // Set explicit alignment, since we may need to realign the top.
     return MinABIStackAlignInBytes;
   }

Removed: cfe/trunk/test/CodeGen/x86_32-align-linux.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/x86_32-align-linux.c?rev=362185&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/x86_32-align-linux.c (original)
+++ cfe/trunk/test/CodeGen/x86_32-align-linux.c (removed)
@@ -1,25 +0,0 @@
-// RUN: %clang_cc1 -w -fblocks -ffreestanding -triple i386-pc-linux-gnu -emit-llvm -o %t %s
-// RUN: FileCheck < %t %s
-
-#include <immintrin.h>
-
-typedef union {
-        int d[4];
-        __m128 m;
-} M128;
-
-extern void foo(int, ...);
-
-M128 a;
-
-// CHECK-LABEL: define void @test
-// CHECK: entry:
-// CHECK: call void (i32, ...) @foo(i32 1, %union.M128* byval align 16
-// CHECK: call void (i32, ...) @foo(i32 1, <4 x float>
-
-void test(void)
-{
-  foo(1, a);
-  foo(1, a.m);
-}
-

Modified: cfe/trunk/test/CodeGen/x86_32-arguments-linux.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/x86_32-arguments-linux.c?rev=362186&r1=362185&r2=362186&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/x86_32-arguments-linux.c (original)
+++ cfe/trunk/test/CodeGen/x86_32-arguments-linux.c Thu May 30 18:50:07 2019
@@ -3,21 +3,21 @@
 
 // CHECK-LABEL: define void @f56(
 // CHECK: i8 signext %a0, %struct.s56_0* byval align 4 %a1,
-// CHECK: i64 %a2.coerce, %struct.s56_1* byval align 8 %a3,
-// CHECK: <1 x double> %a4, %struct.s56_2* byval align 8 %a5,
-// CHECK: <4 x i32> %a6, %struct.s56_3* byval align 16 %a7,
-// CHECK: <2 x double> %a8, %struct.s56_4* byval align 16 %a9,
-// CHECK: <8 x i32> %a10, %struct.s56_5* byval align 32 %a11,
-// CHECK: <4 x double> %a12, %struct.s56_6* byval align 32 %a13)
+// CHECK: i64 %a2.coerce, %struct.s56_1* byval align 4,
+// CHECK: <1 x double> %a4, %struct.s56_2* byval align 4,
+// CHECK: <4 x i32> %a6, %struct.s56_3* byval align 4,
+// CHECK: <2 x double> %a8, %struct.s56_4* byval align 4,
+// CHECK: <8 x i32> %a10, %struct.s56_5* byval align 4,
+// CHECK: <4 x double> %a12, %struct.s56_6* byval align 4)
 
 // CHECK: call void (i32, ...) @f56_0(i32 1,
 // CHECK: i32 %{{.*}}, %struct.s56_0* byval align 4 %{{[^ ]*}},
-// CHECK: i64 %{{[^ ]*}}, %struct.s56_1* byval align 8 %{{[^ ]*}},
-// CHECK: <1 x double> %{{[^ ]*}}, %struct.s56_2* byval align 8 %{{[^ ]*}},
-// CHECK: <4 x i32> %{{[^ ]*}}, %struct.s56_3* byval align 16 %{{[^ ]*}},
-// CHECK: <2 x double> %{{[^ ]*}}, %struct.s56_4* byval align 16 %{{[^ ]*}},
-// CHECK: <8 x i32> %{{[^ ]*}}, %struct.s56_5* byval align 32 %{{[^ ]*}},
-// CHECK: <4 x double> %{{[^ ]*}}, %struct.s56_6* byval align 32 %{{[^ ]*}})
+// CHECK: i64 %{{[^ ]*}}, %struct.s56_1* byval align 4 %{{[^ ]*}},
+// CHECK: <1 x double> %{{[^ ]*}}, %struct.s56_2* byval align 4 %{{[^ ]*}},
+// CHECK: <4 x i32> %{{[^ ]*}}, %struct.s56_3* byval align 4 %{{[^ ]*}},
+// CHECK: <2 x double> %{{[^ ]*}}, %struct.s56_4* byval align 4 %{{[^ ]*}},
+// CHECK: <8 x i32> %{{[^ ]*}}, %struct.s56_5* byval align 4 %{{[^ ]*}},
+// CHECK: <4 x double> %{{[^ ]*}}, %struct.s56_6* byval align 4 %{{[^ ]*}})
 // CHECK: }
 //
 // <rdar://problem/7964854> [i386] clang misaligns long double in structures




More information about the cfe-commits mailing list