1 ; If a function has linkage "available_externally", make sure that a dllimport
2 ; attribute is not dropped. The library definition (with a dllexport attribute)
3 ; might be in a shared library, rather than merged into this module. Since we
4 ; can't guaranty the definition is available locally, the dllimport attribute
5 ; may be used by later passes and should be preserved.
6 ; RUN: opt -thinlto-bc -thinlto-split-lto-unit -o %t0.bc %s
7 ; RUN: llvm-lto2 run -r %t0.bc,__imp_f,l \
10 ; RUN: -r %t0.bc,e,l \
11 ; RUN: -r %t0.bc,main,x \
12 ; RUN: -save-temps -o %t1 %t0.bc
13 ; RUN: llvm-dis %t1.1.3.import.bc -o - | FileCheck %s
15 ; RUN: opt --unified-lto -thinlto-split-lto-unit -thinlto-bc -o %t0.bc %s
16 ; RUN: llvm-lto2 run -r %t0.bc,__imp_f,l \
17 ; RUN: -r %t0.bc,g,p \
18 ; RUN: -r %t0.bc,g,l \
19 ; RUN: -r %t0.bc,e,l \
20 ; RUN: -r %t0.bc,main,x \
21 ; RUN: --unified-lto=thin \
22 ; RUN: -save-temps -o %t1 %t0.bc
23 ; RUN: llvm-dis %t1.1.3.import.bc -o - | FileCheck %s
24 source_filename = "test.cpp"
25 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
26 target triple = "x86_64-unknown-linux-gnu"
29 @g = global i8 42, comdat, !type !0
31 ; CHECK: define available_externally dllimport ptr @f()
32 define available_externally dllimport i8* @f() {
42 %2 = ptrtoint i8* %1 to i32
45 !0 = !{i32 0, !"typeid"}