56 lines · plain
1; Test to ensure that the Enable Split LTO Unit flag is set properly in the2; summary, and that we correctly silently handle linking bitcode files with3; different values of this flag.4 5; Linking bitcode both with EnableSplitLTOUnit set should work6; RUN: opt -thinlto-bc -thinlto-split-lto-unit -o %t1 %s7; RUN: llvm-bcanalyzer -dump %t1 | FileCheck %s --check-prefix=SPLITLTOUNIT8; RUN: llvm-dis -o - %t1 | FileCheck %s --check-prefix=ENABLESPLITFLAG9; RUN: opt -thinlto-bc -thinlto-split-lto-unit -o %t2 %s10; RUN: llvm-bcanalyzer -dump %t2 | FileCheck %s --check-prefix=SPLITLTOUNIT11; RUN: llvm-dis -o - %t2 | FileCheck %s --check-prefix=ENABLESPLITFLAG12; RUN: llvm-lto2 run -o %t3 %t1 %t213 14; Linking bitcode both without EnableSplitLTOUnit set should work15; RUN: opt -thinlto-bc -thinlto-split-lto-unit=false -o %t1 %s16; RUN: llvm-bcanalyzer -dump %t1 | FileCheck %s --check-prefix=NOSPLITLTOUNIT17; RUN: llvm-dis -o - %t1 | FileCheck %s --check-prefix=NOENABLESPLITFLAG18; RUN: opt -thinlto-bc -thinlto-split-lto-unit=false -o %t2 %s19; RUN: llvm-bcanalyzer -dump %t2 | FileCheck %s --check-prefix=NOSPLITLTOUNIT20; RUN: llvm-dis -o - %t2 | FileCheck %s --check-prefix=NOENABLESPLITFLAG21; RUN: llvm-lto2 run -o %t3 %t1 %t222 23; Linking bitcode with different values of EnableSplitLTOUnit should succeed24; (silently skipping any optimizations like whole program devirt that rely25; on all modules being split).26; RUN: opt -thinlto-bc -thinlto-split-lto-unit -o %t1 %s27; RUN: llvm-bcanalyzer -dump %t1 | FileCheck %s --check-prefix=SPLITLTOUNIT28; RUN: llvm-dis -o - %t1 | FileCheck %s --check-prefix=ENABLESPLITFLAG29; RUN: opt -thinlto-bc -thinlto-split-lto-unit=false -o %t2 %s30; RUN: llvm-bcanalyzer -dump %t2 | FileCheck %s --check-prefix=NOSPLITLTOUNIT31; RUN: llvm-dis -o - %t2 | FileCheck %s --check-prefix=NOENABLESPLITFLAG32; RUN: llvm-lto2 run -o %t3 %t1 %t233 34; Linking bitcode with different values of EnableSplitLTOUnit (reverse order)35; should succeed (silently skipping any optimizations like whole program devirt36; that rely on all modules being split).37; RUN: opt -thinlto-bc -thinlto-split-lto-unit=false -o %t1 %s38; RUN: llvm-bcanalyzer -dump %t1 | FileCheck %s --check-prefix=NOSPLITLTOUNIT39; RUN: llvm-dis -o - %t1 | FileCheck %s --check-prefix=NOENABLESPLITFLAG40; RUN: opt -thinlto-bc -thinlto-split-lto-unit -o %t2 %s41; RUN: llvm-bcanalyzer -dump %t2 | FileCheck %s --check-prefix=SPLITLTOUNIT42; RUN: llvm-dis -o - %t2 | FileCheck %s --check-prefix=ENABLESPLITFLAG43; RUN: llvm-lto2 run -o %t3 %t1 %t244 45; The flag should be set when splitting is disabled (for backwards compatibility46; 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