[llvm] r214058 - Start adding some tests for the gold plugin.
Rafael Espindola
rafael.espindola at gmail.com
Sun Jul 27 16:11:07 PDT 2014
Author: rafael
Date: Sun Jul 27 18:11:06 2014
New Revision: 214058
URL: http://llvm.org/viewvc/llvm-project?rev=214058&view=rev
Log:
Start adding some tests for the gold plugin.
These are only used when the 'ld' in the path is gold and the plugin has
been built, but it is already a start to make sure we don't regress features
that cannot be tested with llvm-lto.
Added:
llvm/trunk/test/tools/gold/
llvm/trunk/test/tools/gold/lit.local.cfg
llvm/trunk/test/tools/gold/option.ll
Modified:
llvm/trunk/test/lit.cfg
Modified: llvm/trunk/test/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/lit.cfg?rev=214058&r1=214057&r2=214058&view=diff
==============================================================================
--- llvm/trunk/test/lit.cfg (original)
+++ llvm/trunk/test/lit.cfg Sun Jul 27 18:11:06 2014
@@ -301,8 +301,28 @@ else:
if config.host_triple == config.target_triple:
config.available_features.add("native")
-# Ask llvm-config about assertion mode.
import subprocess
+
+def have_ld_plugin_support():
+ if not os.path.exists(os.path.join(config.llvm_shlib_dir, 'LLVMgold.so')):
+ return False
+
+ ld_cmd = subprocess.Popen(['ld', '--help'], stdout = subprocess.PIPE)
+ if not '-plugin' in ld_cmd.stdout.read():
+ return False
+ ld_cmd.wait()
+
+ ld_version = subprocess.Popen(['ld', '--version'], stdout = subprocess.PIPE)
+ if not 'GNU gold' in ld_version.stdout.read():
+ return False
+ ld_version.wait()
+
+ return True
+
+if have_ld_plugin_support():
+ config.available_features.add('ld_plugin')
+
+# Ask llvm-config about assertion mode.
try:
llvm_config_cmd = subprocess.Popen(
[os.path.join(llvm_tools_dir, 'llvm-config'), '--assertion-mode'],
Added: llvm/trunk/test/tools/gold/lit.local.cfg
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/gold/lit.local.cfg?rev=214058&view=auto
==============================================================================
--- llvm/trunk/test/tools/gold/lit.local.cfg (added)
+++ llvm/trunk/test/tools/gold/lit.local.cfg Sun Jul 27 18:11:06 2014
@@ -0,0 +1,3 @@
+if (not 'ld_plugin' in config.available_features or
+ not 'X86' in config.root.targets):
+ config.unsupported = True
Added: llvm/trunk/test/tools/gold/option.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/gold/option.ll?rev=214058&view=auto
==============================================================================
--- llvm/trunk/test/tools/gold/option.ll (added)
+++ llvm/trunk/test/tools/gold/option.ll Sun Jul 27 18:11:06 2014
@@ -0,0 +1,24 @@
+; RUN: llvm-as %s -o %t.o
+; RUN: ld -plugin %llvmshlibdir/LLVMgold.so -m elf_x86_64 \
+; RUN: --plugin-opt=-jump-table-type=arity \
+; RUN: --plugin-opt=-mattr=+aes \
+; RUN: -shared %t.o -o %t2.o
+; RUN: llvm-nm %t2.o | FileCheck %s
+
+; CHECK: T __llvm_jump_instr_table_0_1
+; CHECK: T __llvm_jump_instr_table_1_1
+
+target triple = "x86_64-unknown-linux-gnu"
+define i32 @g(i32 %a) unnamed_addr jumptable {
+ ret i32 %a
+}
+
+define i32 @f() unnamed_addr jumptable {
+ ret i32 0
+}
+
+define <2 x i64> @test_avx(<2 x i64> %a0, <2 x i64> %a1) {
+ %res = call <2 x i64> @llvm.x86.aesni.aesenc(<2 x i64> %a0, <2 x i64> %a1)
+ ret <2 x i64> %res
+}
+declare <2 x i64> @llvm.x86.aesni.aesenc(<2 x i64>, <2 x i64>) nounwind readnone
More information about the llvm-commits
mailing list