1 ; REQUIRES: x86-registered-target
2 ; Compile with thinlto indices, to enable thinlto.
3 ; RUN: opt -module-summary %s -o %t1.bc
5 ; Test old lto interface with thinlto (currently known to be broken, so
6 ; the FileCheck line is commented out).
7 ; FIXME: The new LTO implementation has been fixed to not internalize
8 ; (and later dead-code-eliminate) builtin functions. However the old LTO
9 ; implementation still internalizes them, and when used with ThinLTO they
10 ; get dead-code eliminated before the optimizations run that insert calls
11 ; to them (thus breaking these inserted calls). This needs to be fixed.
12 ; RUN: llvm-lto -exported-symbol=main -thinlto-action=run %t1.bc
13 ;;; RUN llvm-nm %t1.bc.thinlto.o | FileCheck %s --check-prefix=CHECK-NM
15 ; Test new lto interface with thinlto.
16 ; RUN: llvm-lto2 run %t1.bc -o %t.out -save-temps \
17 ; RUN: -r %t1.bc,bar,pl \
18 ; RUN: -r %t1.bc,__stack_chk_fail,pl
19 ; RUN: llvm-nm %t.out.1 | FileCheck %s --check-prefix=CHECK-NM
22 ; Re-compile, this time without the thinlto indices.
23 ; RUN: opt %s -o %t4.bc
25 ; Test the new lto interface without thinlto.
26 ; RUN: llvm-lto2 run %t4.bc -o %t5.out -save-temps \
27 ; RUN: -r %t4.bc,bar,pl \
28 ; RUN: -r %t4.bc,__stack_chk_fail,pl
29 ; RUN: llvm-nm %t5.out.0 | FileCheck %s --check-prefix=CHECK-NM
31 ; Test the old lto interface without thinlto. For now we need to
32 ; use a different nm check, because currently the old lto interface
33 ; internalizes these symbols. Once the old lto interface gets
34 ; fixed, we should be able to use the same CHECK-NM tests as the
36 ; RUN: llvm-lto -exported-symbol=main %t4.bc -o %t6
37 ; RUN: llvm-nm %t6 | FileCheck %s --check-prefix=CHECK-NM2
39 ; The final binary should not contain any of the dead functions;
40 ; make sure memmove and memcpy are there.
42 ; CHECK-NM-DAG: T __stack_chk_fail
45 ; Test case for old lto without thinlto. Hopefully these can be
46 ; eliminated once the old lto interface is fixed.
47 ; CHECK-NM2-DAG: t __stack_chk_fail
49 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
50 target triple = "x86_64-unknown-linux-gnu"
57 define void @__stack_chk_fail() {