• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; Test to ensure that the Enable Split LTO Unit flag is set properly in the
2; summary, and that we correctly silently handle linking bitcode files with
3; different values of this flag.
4
5; Linking bitcode both with EnableSplitLTOUnit set should work
6; RUN: opt -thinlto-bc -thinlto-split-lto-unit -o %t1 %s
7; RUN: llvm-bcanalyzer -dump %t1 | FileCheck %s --check-prefix=SPLITLTOUNIT
8; RUN: llvm-dis -o - %t1 | FileCheck %s --check-prefix=ENABLESPLITFLAG
9; RUN: opt -thinlto-bc -thinlto-split-lto-unit -o %t2 %s
10; RUN: llvm-bcanalyzer -dump %t2 | FileCheck %s --check-prefix=SPLITLTOUNIT
11; RUN: llvm-dis -o - %t2 | FileCheck %s --check-prefix=ENABLESPLITFLAG
12; RUN: llvm-lto2 run -o %t3 %t1 %t2
13
14; Linking bitcode both without EnableSplitLTOUnit set should work
15; RUN: opt -thinlto-bc -thinlto-split-lto-unit=false -o %t1 %s
16; RUN: llvm-bcanalyzer -dump %t1 | FileCheck %s --check-prefix=NOSPLITLTOUNIT
17; RUN: llvm-dis -o - %t1 | FileCheck %s --check-prefix=NOENABLESPLITFLAG
18; RUN: opt -thinlto-bc -thinlto-split-lto-unit=false -o %t2 %s
19; RUN: llvm-bcanalyzer -dump %t2 | FileCheck %s --check-prefix=NOSPLITLTOUNIT
20; RUN: llvm-dis -o - %t2 | FileCheck %s --check-prefix=NOENABLESPLITFLAG
21; RUN: llvm-lto2 run -o %t3 %t1 %t2
22
23; Linking bitcode with different values of EnableSplitLTOUnit should succeed
24; (silently skipping any optimizations like whole program devirt that rely
25; on all modules being split).
26; RUN: opt -thinlto-bc -thinlto-split-lto-unit -o %t1 %s
27; RUN: llvm-bcanalyzer -dump %t1 | FileCheck %s --check-prefix=SPLITLTOUNIT
28; RUN: llvm-dis -o - %t1 | FileCheck %s --check-prefix=ENABLESPLITFLAG
29; RUN: opt -thinlto-bc -thinlto-split-lto-unit=false -o %t2 %s
30; RUN: llvm-bcanalyzer -dump %t2 | FileCheck %s --check-prefix=NOSPLITLTOUNIT
31; RUN: llvm-dis -o - %t2 | FileCheck %s --check-prefix=NOENABLESPLITFLAG
32; RUN: llvm-lto2 run -o %t3 %t1 %t2
33
34; Linking bitcode with different values of EnableSplitLTOUnit (reverse order)
35; should succeed (silently skipping any optimizations like whole program devirt
36; that rely on all modules being split).
37; RUN: opt -thinlto-bc -thinlto-split-lto-unit=false -o %t1 %s
38; RUN: llvm-bcanalyzer -dump %t1 | FileCheck %s --check-prefix=NOSPLITLTOUNIT
39; RUN: llvm-dis -o - %t1 | FileCheck %s --check-prefix=NOENABLESPLITFLAG
40; RUN: opt -thinlto-bc -thinlto-split-lto-unit -o %t2 %s
41; RUN: llvm-bcanalyzer -dump %t2 | FileCheck %s --check-prefix=SPLITLTOUNIT
42; RUN: llvm-dis -o - %t2 | FileCheck %s --check-prefix=ENABLESPLITFLAG
43; RUN: llvm-lto2 run -o %t3 %t1 %t2
44
45; The flag should be set when splitting is disabled (for backwards compatibility
46; with older bitcode where it was always enabled).
47; SPLITLTOUNIT: <FLAGS op0=8/>
48; NOSPLITLTOUNIT: <FLAGS op0=0/>
49
50; Check that the corresponding module flag is set when expected.
51; ENABLESPLITFLAG: !{i32 1, !"EnableSplitLTOUnit", i32 1}
52; NOENABLESPLITFLAG-NOT: !{i32 1, !"EnableSplitLTOUnit", i32 1}
53
54target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
55target triple = "x86_64-unknown-linux-gnu"
56