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 \ 8; RUN: -r %t0.bc,g,p \ 9; RUN: -r %t0.bc,g,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 14 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 24source_filename = "test.cpp" 25target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" 26target triple = "x86_64-unknown-linux-gnu" 27 28$g = comdat any 29@g = global i8 42, comdat, !type !0 30 31; CHECK: define available_externally dllimport ptr @f() 32define available_externally dllimport i8* @f() { 33 ret i8* @g 34} 35 36define i8* @e() { 37 ret i8* @g 38} 39 40define i32 @main() { 41 %1 = call i8* @f() 42 %2 = ptrtoint i8* %1 to i32 43 ret i32 %2 44} 45!0 = !{i32 0, !"typeid"} 46