[llvm] r294702 - For X86-64 linux and PPC64 linux align int128 to 16 bytes.

Eric Christopher via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 9 19:32:21 PST 2017


Author: echristo
Date: Thu Feb  9 21:32:21 2017
New Revision: 294702

URL: http://llvm.org/viewvc/llvm-project?rev=294702&view=rev
Log:
For X86-64 linux and PPC64 linux align int128 to 16 bytes.

For other platforms we should find out what they need and likely
make the same change, however, a smaller additional change is easier
for platforms we know have it specified	in the ABI. As part of this
rewrite some of the handling in the backends for data layout and update
a bunch of testcases.

Based on a patch by Simonas Kazlauskas!

Modified:
    llvm/trunk/lib/Target/PowerPC/PPCTargetMachine.cpp
    llvm/trunk/lib/Target/X86/X86TargetMachine.cpp
    llvm/trunk/test/LTO/Resolution/X86/Inputs/comdat.ll
    llvm/trunk/test/LTO/Resolution/X86/Inputs/common2.ll
    llvm/trunk/test/LTO/Resolution/X86/Inputs/mixed_lto.ll
    llvm/trunk/test/LTO/Resolution/X86/comdat.ll
    llvm/trunk/test/LTO/Resolution/X86/common2.ll
    llvm/trunk/test/LTO/Resolution/X86/lowertypetests.ll
    llvm/trunk/test/LTO/Resolution/X86/mixed_lto.ll
    llvm/trunk/test/ThinLTO/X86/Inputs/debuginfo-compositetype-import.ll
    llvm/trunk/test/ThinLTO/X86/Inputs/linkonce_aliasee_ref_import.ll
    llvm/trunk/test/ThinLTO/X86/Inputs/linkonce_resolution_comdat.ll
    llvm/trunk/test/ThinLTO/X86/Inputs/module_asm.ll
    llvm/trunk/test/ThinLTO/X86/Inputs/module_asm2.ll
    llvm/trunk/test/ThinLTO/X86/cache-config.ll
    llvm/trunk/test/ThinLTO/X86/debuginfo-compositetype-import.ll
    llvm/trunk/test/ThinLTO/X86/linkonce_aliasee_ref_import.ll
    llvm/trunk/test/ThinLTO/X86/linkonce_resolution_comdat.ll
    llvm/trunk/test/ThinLTO/X86/module_asm2.ll
    llvm/trunk/test/ThinLTO/X86/module_asm_glob.ll
    llvm/trunk/test/tools/llvm-lto2/X86/pipeline.ll

Modified: llvm/trunk/lib/Target/PowerPC/PPCTargetMachine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCTargetMachine.cpp?rev=294702&r1=294701&r2=294702&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCTargetMachine.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCTargetMachine.cpp Thu Feb  9 21:32:21 2017
@@ -120,6 +120,11 @@ static std::string getDataLayoutString(c
   else
     Ret += "-f64:32:64";
 
+  // 128 bit integers are always aligned to 128 bits, but only 64-bit matters,
+  // because __int128 is only supoprted on 64-bit targets.
+  if (is64Bit && T.isOSLinux())
+    Ret += "-i128:128";
+
   // PPC64 has 32 and 64 bit registers, PPC32 has only 32 bit ones.
   if (is64Bit)
     Ret += "-n32:64";

Modified: llvm/trunk/lib/Target/X86/X86TargetMachine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetMachine.cpp?rev=294702&r1=294701&r2=294702&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86TargetMachine.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86TargetMachine.cpp Thu Feb  9 21:32:21 2017
@@ -109,6 +109,11 @@ static std::string computeDataLayout(con
   else
     Ret += "-f64:32:64";
 
+  // 128 bit integers are always aligned to 128 bits, but only 64-bit matters,
+  // because __int128 is only supoprted on 64-bit targets.
+  if (TT.isArch64Bit() && TT.isOSLinux())
+    Ret += "-i128:128";
+
   // Some ABIs align long double to 128 bits, others to 32.
   if (TT.isOSNaCl() || TT.isOSIAMCU())
     ; // No f80

Modified: llvm/trunk/test/LTO/Resolution/X86/Inputs/comdat.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/LTO/Resolution/X86/Inputs/comdat.ll?rev=294702&r1=294701&r2=294702&view=diff
==============================================================================
--- llvm/trunk/test/LTO/Resolution/X86/Inputs/comdat.ll (original)
+++ llvm/trunk/test/LTO/Resolution/X86/Inputs/comdat.ll Thu Feb  9 21:32:21 2017
@@ -1,4 +1,4 @@
-target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target datalayout = "e-m:e-i64:64-i128:128-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
 
 $c2 = comdat any

Modified: llvm/trunk/test/LTO/Resolution/X86/Inputs/common2.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/LTO/Resolution/X86/Inputs/common2.ll?rev=294702&r1=294701&r2=294702&view=diff
==============================================================================
--- llvm/trunk/test/LTO/Resolution/X86/Inputs/common2.ll (original)
+++ llvm/trunk/test/LTO/Resolution/X86/Inputs/common2.ll Thu Feb  9 21:32:21 2017
@@ -1,4 +1,4 @@
-target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target datalayout = "e-m:e-i64:64-i128:128-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
 
 @v = common global i16 0, align 4

Modified: llvm/trunk/test/LTO/Resolution/X86/Inputs/mixed_lto.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/LTO/Resolution/X86/Inputs/mixed_lto.ll?rev=294702&r1=294701&r2=294702&view=diff
==============================================================================
--- llvm/trunk/test/LTO/Resolution/X86/Inputs/mixed_lto.ll (original)
+++ llvm/trunk/test/LTO/Resolution/X86/Inputs/mixed_lto.ll Thu Feb  9 21:32:21 2017
@@ -1,4 +1,4 @@
-target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target datalayout = "e-m:e-i64:64-i128:128-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
 declare i32 @g()
 define i32 @main() {

Modified: llvm/trunk/test/LTO/Resolution/X86/comdat.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/LTO/Resolution/X86/comdat.ll?rev=294702&r1=294701&r2=294702&view=diff
==============================================================================
--- llvm/trunk/test/LTO/Resolution/X86/comdat.ll (original)
+++ llvm/trunk/test/LTO/Resolution/X86/comdat.ll Thu Feb  9 21:32:21 2017
@@ -22,7 +22,7 @@
 ; RUN:  -r=%t2.o,a25,px
 ; RUN: llvm-dis %t3.o.0.2.internalize.bc -o - | FileCheck %s
 
-target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target datalayout = "e-m:e-i64:64-i128:128-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
 
 $c1 = comdat any

Modified: llvm/trunk/test/LTO/Resolution/X86/common2.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/LTO/Resolution/X86/common2.ll?rev=294702&r1=294701&r2=294702&view=diff
==============================================================================
--- llvm/trunk/test/LTO/Resolution/X86/common2.ll (original)
+++ llvm/trunk/test/LTO/Resolution/X86/common2.ll Thu Feb  9 21:32:21 2017
@@ -70,7 +70,7 @@
 ; RUN:  -r %t2.bc,bar,px
 ; RUN: llvm-dis < %t.o.0.0.preopt.bc | FileCheck %s --check-prefix=BOTH-PREVAILED2
 
-target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target datalayout = "e-m:e-i64:64-i128:128-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
 
 @v = common global i8 0, align 8

Modified: llvm/trunk/test/LTO/Resolution/X86/lowertypetests.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/LTO/Resolution/X86/lowertypetests.ll?rev=294702&r1=294701&r2=294702&view=diff
==============================================================================
--- llvm/trunk/test/LTO/Resolution/X86/lowertypetests.ll (original)
+++ llvm/trunk/test/LTO/Resolution/X86/lowertypetests.ll Thu Feb  9 21:32:21 2017
@@ -6,7 +6,7 @@
 ; MERGED: R __typeid_foo_global_addr
 ; CHECK: U __typeid_foo_global_addr
 
-target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target datalayout = "e-m:e-i64:64-i128:128-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
 
 @foo = global i32 0, !type !0

Modified: llvm/trunk/test/LTO/Resolution/X86/mixed_lto.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/LTO/Resolution/X86/mixed_lto.ll?rev=294702&r1=294701&r2=294702&view=diff
==============================================================================
--- llvm/trunk/test/LTO/Resolution/X86/mixed_lto.ll (original)
+++ llvm/trunk/test/LTO/Resolution/X86/mixed_lto.ll Thu Feb  9 21:32:21 2017
@@ -19,7 +19,7 @@
 ; RUN: llvm-nm %t5.o.0 | FileCheck %s --check-prefix=NM0
 ; RUN: llvm-nm %t5.o.1 | FileCheck %s --check-prefix=NM1
 
-target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target datalayout = "e-m:e-i64:64-i128:128-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
 define i32 @g() {
   ret i32 0

Modified: llvm/trunk/test/ThinLTO/X86/Inputs/debuginfo-compositetype-import.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ThinLTO/X86/Inputs/debuginfo-compositetype-import.ll?rev=294702&r1=294701&r2=294702&view=diff
==============================================================================
--- llvm/trunk/test/ThinLTO/X86/Inputs/debuginfo-compositetype-import.ll (original)
+++ llvm/trunk/test/ThinLTO/X86/Inputs/debuginfo-compositetype-import.ll Thu Feb  9 21:32:21 2017
@@ -1,6 +1,6 @@
 ; ModuleID = 'debuginfo-compositetype-import2.c'
 source_filename = "debuginfo-compositetype-import2.c"
-target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target datalayout = "e-m:e-i64:64-i128:128-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
 
 ; Function Attrs: nounwind uwtable

Modified: llvm/trunk/test/ThinLTO/X86/Inputs/linkonce_aliasee_ref_import.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ThinLTO/X86/Inputs/linkonce_aliasee_ref_import.ll?rev=294702&r1=294701&r2=294702&view=diff
==============================================================================
--- llvm/trunk/test/ThinLTO/X86/Inputs/linkonce_aliasee_ref_import.ll (original)
+++ llvm/trunk/test/ThinLTO/X86/Inputs/linkonce_aliasee_ref_import.ll Thu Feb  9 21:32:21 2017
@@ -1,4 +1,4 @@
-target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target datalayout = "e-m:e-i64:64-i128:128-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-grtev4-linux-gnu"
 
 define i32 @main() #0 {

Modified: llvm/trunk/test/ThinLTO/X86/Inputs/linkonce_resolution_comdat.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ThinLTO/X86/Inputs/linkonce_resolution_comdat.ll?rev=294702&r1=294701&r2=294702&view=diff
==============================================================================
--- llvm/trunk/test/ThinLTO/X86/Inputs/linkonce_resolution_comdat.ll (original)
+++ llvm/trunk/test/ThinLTO/X86/Inputs/linkonce_resolution_comdat.ll Thu Feb  9 21:32:21 2017
@@ -1,4 +1,4 @@
-target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target datalayout = "e-m:e-i64:64-i128:128-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
 
 $c2 = comdat any

Modified: llvm/trunk/test/ThinLTO/X86/Inputs/module_asm.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ThinLTO/X86/Inputs/module_asm.ll?rev=294702&r1=294701&r2=294702&view=diff
==============================================================================
--- llvm/trunk/test/ThinLTO/X86/Inputs/module_asm.ll (original)
+++ llvm/trunk/test/ThinLTO/X86/Inputs/module_asm.ll Thu Feb  9 21:32:21 2017
@@ -1,4 +1,4 @@
-target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target datalayout = "e-m:e-i64:64-i128:128-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
 
 define i32 @main({ i64, { i64, i8* }* } %unnamed) #0 {

Modified: llvm/trunk/test/ThinLTO/X86/Inputs/module_asm2.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ThinLTO/X86/Inputs/module_asm2.ll?rev=294702&r1=294701&r2=294702&view=diff
==============================================================================
--- llvm/trunk/test/ThinLTO/X86/Inputs/module_asm2.ll (original)
+++ llvm/trunk/test/ThinLTO/X86/Inputs/module_asm2.ll Thu Feb  9 21:32:21 2017
@@ -1,4 +1,4 @@
-target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target datalayout = "e-m:e-i64:64-i128:128-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
 
 define i32 @main({ i64, { i64, i8* }* } %unnamed) #0 {

Modified: llvm/trunk/test/ThinLTO/X86/cache-config.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ThinLTO/X86/cache-config.ll?rev=294702&r1=294701&r2=294702&view=diff
==============================================================================
--- llvm/trunk/test/ThinLTO/X86/cache-config.ll (original)
+++ llvm/trunk/test/ThinLTO/X86/cache-config.ll Thu Feb  9 21:32:21 2017
@@ -18,7 +18,7 @@
 ; RUN: llvm-lto2 -o %t.o %t.bc -cache-dir %t.cache -r=%t.bc,globalfunc,plx -default-triple=x86_64-unknown-linux-gnu
 ; RUN: ls %t.cache | count 15
 
-target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target datalayout = "e-m:e-i64:64-i128:128-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
 
 define void @globalfunc() {

Modified: llvm/trunk/test/ThinLTO/X86/debuginfo-compositetype-import.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ThinLTO/X86/debuginfo-compositetype-import.ll?rev=294702&r1=294701&r2=294702&view=diff
==============================================================================
--- llvm/trunk/test/ThinLTO/X86/debuginfo-compositetype-import.ll (original)
+++ llvm/trunk/test/ThinLTO/X86/debuginfo-compositetype-import.ll Thu Feb  9 21:32:21 2017
@@ -34,7 +34,7 @@
 
 ; ModuleID = 'debuginfo-compositetype-import.c'
 source_filename = "debuginfo-compositetype-import.c"
-target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target datalayout = "e-m:e-i64:64-i128:128-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
 
 ; Function Attrs: nounwind uwtable

Modified: llvm/trunk/test/ThinLTO/X86/linkonce_aliasee_ref_import.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ThinLTO/X86/linkonce_aliasee_ref_import.ll?rev=294702&r1=294701&r2=294702&view=diff
==============================================================================
--- llvm/trunk/test/ThinLTO/X86/linkonce_aliasee_ref_import.ll (original)
+++ llvm/trunk/test/ThinLTO/X86/linkonce_aliasee_ref_import.ll Thu Feb  9 21:32:21 2017
@@ -24,7 +24,7 @@
 ; Check that we imported a ref (and not def) to baz.clone
 ; NM2: U baz.clone
 
-target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target datalayout = "e-m:e-i64:64-i128:128-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-grtev4-linux-gnu"
 
 $baz.clone = comdat any

Modified: llvm/trunk/test/ThinLTO/X86/linkonce_resolution_comdat.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ThinLTO/X86/linkonce_resolution_comdat.ll?rev=294702&r1=294701&r2=294702&view=diff
==============================================================================
--- llvm/trunk/test/ThinLTO/X86/linkonce_resolution_comdat.ll (original)
+++ llvm/trunk/test/ThinLTO/X86/linkonce_resolution_comdat.ll Thu Feb  9 21:32:21 2017
@@ -21,7 +21,7 @@
 ; and inlined into g()
 ; NM2-NOT: f
 
-target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target datalayout = "e-m:e-i64:64-i128:128-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
 
 $c1 = comdat any

Modified: llvm/trunk/test/ThinLTO/X86/module_asm2.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ThinLTO/X86/module_asm2.ll?rev=294702&r1=294701&r2=294702&view=diff
==============================================================================
--- llvm/trunk/test/ThinLTO/X86/module_asm2.ll (original)
+++ llvm/trunk/test/ThinLTO/X86/module_asm2.ll Thu Feb  9 21:32:21 2017
@@ -64,7 +64,7 @@
 ; NM1-NOT: b
 ; NM1-NOT: x
 
-target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target datalayout = "e-m:e-i64:64-i128:128-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
 
 @b = internal global i32 1, align 4

Modified: llvm/trunk/test/ThinLTO/X86/module_asm_glob.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ThinLTO/X86/module_asm_glob.ll?rev=294702&r1=294701&r2=294702&view=diff
==============================================================================
--- llvm/trunk/test/ThinLTO/X86/module_asm_glob.ll (original)
+++ llvm/trunk/test/ThinLTO/X86/module_asm_glob.ll Thu Feb  9 21:32:21 2017
@@ -17,7 +17,7 @@
 ; NM0: T foo
 ; NM1-NOT: foo
 
-target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target datalayout = "e-m:e-i64:64-i128:128-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
 
 module asm "\09.text"

Modified: llvm/trunk/test/tools/llvm-lto2/X86/pipeline.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-lto2/X86/pipeline.ll?rev=294702&r1=294701&r2=294702&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-lto2/X86/pipeline.ll (original)
+++ llvm/trunk/test/tools/llvm-lto2/X86/pipeline.ll Thu Feb  9 21:32:21 2017
@@ -10,7 +10,7 @@
 ; is accepted).
 ; RUN: llvm-lto2 %t1.bc -o %t.o -lto-use-new-pm -r %t1.bc,patatino,px
 
-target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target datalayout = "e-m:e-i64:64-i128:128-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
 
 define void @patatino() {




More information about the llvm-commits mailing list