69 lines · plain
1; REQUIRES: asserts2; Test to ensure that the Unified LTO flag is set properly in the summary, and3; that we emit the correct error when linking bitcode files with different4; values of this flag.5 6; Linking bitcode both without UnifiedLTO set should work7; RUN: opt -thinlto-bc -thinlto-split-lto-unit -o %t1 %s8; RUN: llvm-bcanalyzer -dump %t1 | FileCheck %s --check-prefix=NOUNIFIEDLTO9; RUN: llvm-dis -o - %t1 | FileCheck %s --check-prefix=NOUNIFIEDLTOFLAG10; RUN: opt -thinlto-bc -thinlto-split-lto-unit -o %t2 %s11; RUN: llvm-bcanalyzer -dump %t2 | FileCheck %s --check-prefix=NOUNIFIEDLTO12; RUN: llvm-dis -o - %t2 | FileCheck %s --check-prefix=NOUNIFIEDLTOFLAG13; RUN: llvm-lto2 run -o %t3 %t1 %t214; RUN: not llvm-lto2 run --unified-lto=thin -o %t3 %t1 %t2 2>&1 | \15; RUN: FileCheck --allow-empty %s --check-prefix UNIFIEDERR16 17; Linking bitcode with different values of UnifiedLTO should fail18; RUN: opt -thinlto-bc -thinlto-split-lto-unit -o %t1 %s19; RUN: llvm-bcanalyzer -dump %t1 | FileCheck %s --check-prefix=NOUNIFIEDLTO20; RUN: llvm-dis -o - %t1 | FileCheck %s --check-prefix=NOUNIFIEDLTOFLAG21; RUN: opt -unified-lto -thinlto-bc -thinlto-split-lto-unit -o %t2 %s22; RUN: llvm-bcanalyzer -dump %t2 | FileCheck %s --check-prefix=UNIFIEDLTO23; RUN: llvm-dis -o - %t2 | FileCheck %s --check-prefix=UNIFIEDLTOFLAG24; RUN: not llvm-lto2 run --unified-lto=thin -o %t3 %t1 %t2 2>&1 | \25; RUN: FileCheck --allow-empty %s --check-prefix UNIFIEDERR26 27; Linking bitcode with identical Unified LTO flags should succeed28; RUN: opt -unified-lto -thinlto-bc -thinlto-split-lto-unit -o %t1 %s29; RUN: llvm-bcanalyzer -dump %t1 | FileCheck %s --check-prefix=UNIFIEDLTO30; RUN: llvm-dis -o - %t1 | FileCheck %s --check-prefix=UNIFIEDLTOFLAG31; RUN: opt -unified-lto -thinlto-bc -thinlto-split-lto-unit -o %t2 %s32; RUN: llvm-bcanalyzer -dump %t2 | FileCheck %s --check-prefix=UNIFIEDLTO33; RUN: llvm-dis -o - %t2 | FileCheck %s --check-prefix=UNIFIEDLTOFLAG34; RUN: llvm-lto2 run --unified-lto=full --debug-only=lto -o %t3 %t1 %t2 2>&1 | \35; RUN: FileCheck --allow-empty %s --check-prefix NOUNIFIEDERR --check-prefix FULL36; RUN: llvm-lto2 run --unified-lto=thin --debug-only=lto -o %t3 %t1 %t2 2>&1 | \37; RUN: FileCheck --allow-empty %s --check-prefix NOUNIFIEDERR --check-prefix THIN38; RUN: llvm-lto2 run --debug-only=lto -o %t3 %t1 %t2 2>&1 | \39; RUN: FileCheck --allow-empty %s --check-prefix THIN40 41; Test invalid unified-lto mode causes an error message return.42; RUN: not llvm-lto2 run --unified-lto=foo -o %t3 %t1 %t2 2>&1 | \43; RUN: FileCheck %s --check-prefix INVALIDMODE44; RUN: not llvm-lto2 run --unified-lto="foo" -o %t3 %t1 %t2 2>&1 | \45; RUN: FileCheck %s --check-prefix INVALIDMODE46; RUN: not llvm-lto2 run --unified-lto=1 -o %t3 %t1 %t2 2>&1 | \47; RUN: FileCheck %s --check-prefix INVALIDMODE48 49; INVALIDMODE: for the --unified-lto option: Cannot find option named50 51 52; UNIFIEDERR: unified LTO compilation must use compatible bitcode modules53; NOUNIFIEDERR-NOT: unified LTO compilation must use compatible bitcode modules54 55; The flag should be set when UnifiedLTO is enabled56; UNIFIEDLTO: <FLAGS op0=520/>57; NOUNIFIEDLTO: <FLAGS op0=8/>58 59; Check that the corresponding module flag is set when expected.60; UNIFIEDLTOFLAG: !{i32 1, !"UnifiedLTO", i32 1}61; NOUNIFIEDLTOFLAG-NOT: !{i32 1, !"UnifiedLTO", i32 1}62 63; FULL: Running regular LTO64; THIN: Running ThinLTO65 66target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"67target triple = "x86_64-unknown-linux-gnu"68 69