Skip to content

Commit d178f4f

Browse files
committed
Make the default triple optional by allowing an empty string
When building LLVM as a (potentially dynamic) library that can be linked against by multiple compilers, the default triple is not really meaningful. We allow to explicitely set it to an empty string when configuring LLVM. In this case, said "target independent" tests in the test suite that are using the default triple are disabled by matching the newly available feature "default_triple". Reviewers: probinson, echristo Differential Revision: http://reviews.llvm.org/D12660 From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 247775
1 parent 8e468d6 commit d178f4f

File tree

116 files changed

+57
-25
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+57
-25
lines changed

llvm/include/llvm/Config/config.h.cmake

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -420,8 +420,10 @@
420420
/* Installation directory for data files */
421421
#cmakedefine LLVM_DATADIR "${LLVM_DATADIR}"
422422

423-
/* Target triple LLVM will generate code for by default */
424-
#cmakedefine LLVM_DEFAULT_TARGET_TRIPLE "${LLVM_DEFAULT_TARGET_TRIPLE}"
423+
/* Target triple LLVM will generate code for by default
424+
* Doesn't use `cmakedefine` because it is allowed to be empty.
425+
*/
426+
#define LLVM_DEFAULT_TARGET_TRIPLE "${LLVM_DEFAULT_TARGET_TRIPLE}"
425427

426428
/* Installation directory for documentation */
427429
#cmakedefine LLVM_DOCSDIR "${LLVM_DOCSDIR}"

llvm/test/BugPoint/remove_arguments_test.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
; Test to make sure that arguments are removed from the function if they are
66
; unnecessary. And clean up any types that frees up too.
77

8-
; CHECK: target triple
8+
; CHECK: ModuleID
99
; CHECK-NOT: struct.anon
1010
%struct.anon = type { i32 }
1111

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
if 'native' not in config.available_features:
1+
if not config.target_triple:
22
config.unsupported = True
33

llvm/test/CodeGen/PowerPC/2006-01-20-ShiftPartsCrash.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
; RUN: llc < %s
2+
; REQUIRES: default_triple
23

34
define void @iterative_hash_host_wide_int() {
45
%zero = alloca i32 ; <i32*> [#uses=2]

llvm/test/CodeGen/PowerPC/2006-08-15-SelectionCrash.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
; RUN: llc < %s
2+
; REQUIRES: default_triple
23

34
%struct..0anon = type { i32 }
45
%struct.rtx_def = type { i16, i8, i8, [1 x %struct..0anon] }

llvm/test/CodeGen/PowerPC/2006-12-07-LargeAlloca.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
; RUN: llc < %s -march=ppc64
22
; RUN: llc < %s -march=ppc32
33
; RUN: llc < %s
4+
; REQUIRES: default_triple
45

56
define void @bitap() {
67
entry:

llvm/test/CodeGen/PowerPC/2006-12-07-SelectCrash.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
; RUN: llc < %s -march=ppc64
22
; RUN: llc < %s -march=ppc32
33
; RUN: llc < %s
4+
; REQUIRES: default_triple
45

56
@qsz.b = external global i1 ; <i1*> [#uses=1]
67

llvm/test/CodeGen/PowerPC/2007-11-19-VectorSplitting.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
; RUN: llc < %s -march=ppc32 -mcpu=g3
33
; RUN: llc < %s -march=ppc32 -mcpu=g5
44
; PR1811
5+
; REQUIRES: default_triple
56

67
define void @execute_shader(<4 x float>* %OUT, <4 x float>* %IN, <4 x float>*
78
%CONST) {

llvm/test/CodeGen/PowerPC/load-shift-combine.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
; RUN: llc < %s
2+
; REQUIRES: default_triple
23

34
; This used to cause a crash. A standard load is converted to a pre-increment
45
; load. Later the pre-increment load is combined with a subsequent SRL to

llvm/test/CodeGen/X86/2006-10-02-BoolRetCrash.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
; RUN: llc < %s
22
; PR933
3+
; REQUIRES: default_triple
34

45
define fastcc i1 @test() {
56
ret i1 true

llvm/test/CodeGen/X86/2009-06-05-VariableIndexInsert.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
; RUN: llc < %s
2+
; REQUIRES: default_triple
23

34
define <2 x i64> @_mm_insert_epi16(<2 x i64> %a, i32 %b, i32 %imm) nounwind readnone {
45
entry:

llvm/test/CodeGen/X86/2009-06-06-ConcatVectors.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
; RUN: llc < %s
2+
; REQUIRES: default_triple
23

34
define <2 x i64> @_mm_movpi64_pi64(<1 x i64> %a, <1 x i64> %b) nounwind readnone {
45
entry:

llvm/test/CodeGen/X86/2010-02-01-DbgValueCrash.ll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
; RUN: llc -O1 < %s
2+
; REQUIRES: default_triple
3+
24
; ModuleID = 'pr6157.bc'
35
; formerly crashed in SelectionDAGBuilder
46

llvm/test/CodeGen/X86/2010-07-06-DbgCrash.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
; RUN: llc -O0 -relocation-model pic < %s -o /dev/null
2+
; REQUIRES: default_triple
23
; PR7545
34
@.str = private constant [4 x i8] c"one\00", align 1 ; <[4 x i8]*> [#uses=1]
45
@.str1 = private constant [4 x i8] c"two\00", align 1 ; <[5 x i8]*> [#uses=1]

llvm/test/CodeGen/X86/GC/alloc_loop.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
; RUN: llc < %s
2+
; REQUIRES: default_triple
23

34

45
declare i8* @llvm_gc_allocate(i32)

llvm/test/CodeGen/X86/GC/cg-O0.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
; RUN: llc < %s -O0
2+
; REQUIRES: default_triple
23

34
define i32 @main() {
45
entry:

llvm/test/CodeGen/X86/GC/lower_gcroot.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
; RUN: llc < %s
2+
; REQUIRES: default_triple
23

34
%Env = type i8*
45

llvm/test/CodeGen/X86/extractelement-shuffle.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
; RUN: llc < %s
2+
; REQUIRES: default_triple
23

34
; Examples that exhibits a bug in DAGCombine. The case is triggered by the
45
; following program. The bug is DAGCombine assumes that the bit convert

llvm/test/CodeGen/X86/vshift_scalar.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
; RUN: llc < %s
2+
; REQUIRES: default_triple
23

34
; Legalization test that requires scalarizing a vector.
45

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
if not config.target_triple:
2+
config.unsupported = True
3+

llvm/test/DebugInfo/lit.local.cfg

Lines changed: 0 additions & 3 deletions
This file was deleted.

llvm/test/Feature/optnone-llc.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
; RUN: llc -O3 -debug %s -o /dev/null 2>&1 | FileCheck %s --check-prefix=LLC-Ox
55
; RUN: llc -misched-postra -debug %s -o /dev/null 2>&1 | FileCheck %s --check-prefix=LLC-MORE
66

7-
; REQUIRES: asserts, native
7+
; REQUIRES: asserts, default_triple
88

99
; This test verifies that we don't run Machine Function optimizations
1010
; on optnone functions.

llvm/test/Feature/optnone.ll

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
; RUN: llvm-as < %s | llvm-dis | FileCheck %s
2-
; REQUIRE: native
32

43
; Check for the presence of attribute optnone in the disassembly.
54

llvm/test/LTO/X86/bcsection.ll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
; RUN: llvm-lto -exported-symbol=main -exported-symbol=_main -o %T/bcsection.macho.o %T/bcsection.macho.bco
1616
; RUN: llvm-nm %T/bcsection.macho.o | FileCheck %s
1717

18+
; REQUIRES: default_triple
19+
1820
; CHECK: main
1921
define i32 @main() {
2022
ret i32 0

llvm/test/LTO/X86/current-section.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
; RUN: llvm-as < %s >%t1
22
; RUN: llvm-lto -o %t2 %t1
3+
; REQUIRES: default_triple
34

45
module asm ".align 4"

llvm/test/LTO/X86/list-symbols.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
; RUN: llvm-as -o %T/1.bc %s
22
; RUN: llvm-as -o %T/2.bc %S/Inputs/list-symbols.ll
33
; RUN: llvm-lto -list-symbols-only %T/1.bc %T/2.bc | FileCheck %s
4+
; REQUIRES: default_triple
45

56
; CHECK-LABEL: 1.bc:
67
; CHECK-DAG: foo

llvm/test/Linker/subprogram-linkonce-weak.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
; REQUIRES: native
21
; RUN: llvm-link %s %S/Inputs/subprogram-linkonce-weak.ll -S -o %t1
32
; RUN: FileCheck %s -check-prefix=LW -check-prefix=CHECK <%t1
43
; RUN: llvm-link %S/Inputs/subprogram-linkonce-weak.ll %s -S -o %t2
54
; RUN: FileCheck %s -check-prefix=WL -check-prefix=CHECK <%t2
5+
; REQUIRES: default_triple
66

77
; This testcase tests the following flow:
88
; - File A defines a linkonce version of @foo which has inlined into @bar.

llvm/test/Linker/type-unique-odr-a.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; REQUIRES: object-emission, native
1+
; REQUIRES: default_triple, object-emission
22
;
33
; RUN: llvm-link %s %p/type-unique-odr-b.ll -S -o - | %llc_dwarf -dwarf-linkage-names=Enable -filetype=obj -O0 | llvm-dwarfdump -debug-dump=info - | FileCheck %s
44
;

llvm/test/Linker/type-unique-simple-a.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; REQUIRES: object-emission, native
1+
; REQUIRES: default_triple, object-emission
22

33
; RUN: llvm-link %s %p/type-unique-simple-b.ll -S -o %t
44
; RUN: cat %t | FileCheck %s -check-prefix=LINK

llvm/test/Linker/type-unique-simple2-a.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; REQUIRES: object-emission, native
1+
; REQUIRES: default_triple, object-emission
22
;
33
; RUN: llvm-link %s %p/type-unique-simple2-b.ll -S -o - | %llc_dwarf -filetype=obj -O0 | llvm-dwarfdump -debug-dump=info - | FileCheck %s
44
;

llvm/test/Linker/type-unique-simple2.ll

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
; REQUIRES: object-emission; native
1+
; REQUIRES: object-emission
2+
; REQUIRES: default_triple
23

34
; RUN: llvm-link %S/Inputs/type-unique-simple2-a.ll %S/Inputs/type-unique-simple2-b.ll -S -o %t
45
; RUN: cat %t | FileCheck %S/Inputs/type-unique-simple2-a.ll -check-prefix=LINK

llvm/test/Linker/type-unique-type-array-a.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; REQUIRES: object-emission, native
1+
; REQUIRES: default_triple, object-emission
22
;
33
; RUN: llvm-link %s %p/type-unique-type-array-b.ll -S -o - | %llc_dwarf -filetype=obj -O0 | llvm-dwarfdump -debug-dump=info - | FileCheck %s
44
;

llvm/test/MC/ELF/cfi-version.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
; .debug_frame is not emitted for targeting Windows x64.
66
; REQUIRES: debug_frame
7+
; REQUIRES: default_triple
78

89
; Function Attrs: nounwind
910
define i32 @foo() #0 {

llvm/test/Other/2010-05-06-Printer.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
; REQUIRES: native
21
; RUN: llc -O2 -print-after-all < %s 2>/dev/null
2+
; REQUIRES: default_triple
33

44
define void @tester(){
55
ret void

llvm/test/Transforms/BranchFolding/2007-10-19-InlineAsmDirectives.ll

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
; RUN: opt < %s -O3 | llc -no-integrated-as | FileCheck %s
2-
; REQUIRES: X86
2+
; REQUIRES: default_triple
3+
34
;; We don't want branch folding to fold asm directives.
45

56
; CHECK: bork_directive
@@ -11,7 +12,7 @@ entry:
1112
%tmp = icmp eq i32 %param, 0
1213
br i1 %tmp, label %cond_true, label %cond_false
1314

14-
cond_true:
15+
cond_true:
1516
call void asm sideeffect ".bork_directive /* ${0:c}:${1:c} */", "i,i,~{dirflag},~{fpsr},~{flags}"( i32 37, i32 927 )
1617
ret void
1718

llvm/test/lit.cfg

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -355,11 +355,15 @@ if config.have_zlib == "1":
355355
else:
356356
config.available_features.add("nozlib")
357357

358-
# Native compilation: host arch == target arch and native backend built-in
358+
# LLVM can be configured with an empty default triple
359+
# Some tests are "generic" and require a valid default triple
360+
if config.target_triple:
361+
config.available_features.add("default_triple")
362+
363+
# Native compilation: host arch == default triple arch
359364
# FIXME: Consider cases that target can be executed
360365
# even if host_triple were different from target_triple.
361-
if (config.host_triple == config.target_triple and
362-
config.native_target in config.targets_to_build):
366+
if config.host_triple == config.target_triple:
363367
config.available_features.add("native")
364368

365369
import subprocess

llvm/test/tools/llvm-mc/basic.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# RUN: not llvm-mc %t.blah -o %t2 2>&1 | FileCheck --check-prefix=ENOENT %s
2-
# REQUIRES: native
2+
# REQUIRES: default_triple
33

44
# ENOENT: {{.*}}.blah: {{[Nn]}}o such file or directory
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# RUN: not llvm-mc --fatal-warnings %s 2>&1 | FileCheck %s
22
# XFAIL: hexagon
3-
# REQUIRES: native
3+
# REQUIRES: default_triple
44

55
# CHECK: error: .warning directive invoked in source file
66
.warning
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
RUN: llvm-mc -disassemble %s
2-
# REQUIRES: native
2+
# REQUIRES: default_triple

llvm/test/tools/llvm-mc/lit.local.cfg

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
if not config.target_triple:
2+
config.unsupported = True
3+
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# RUN: llvm-mc --no-warn %s 2>&1 | FileCheck %s
22
# XFAIL: hexagon
3-
# REQUIRES: native
3+
# REQUIRES: default_triple
44

55
# CHECK-NOT: warning:
66
.warning

0 commit comments

Comments
 (0)