46 lines · plain
1; If a function has linkage "available_externally", make sure that a dllimport2; 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 we4; can't guaranty the definition is available locally, the dllimport attribute5; may be used by later passes and should be preserved.6; RUN: opt -thinlto-bc -thinlto-split-lto-unit -o %t0.bc %s7; 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.bc13; RUN: llvm-dis %t1.1.3.import.bc -o - | FileCheck %s14 15; RUN: opt --unified-lto -thinlto-split-lto-unit -thinlto-bc -o %t0.bc %s16; 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.bc23; RUN: llvm-dis %t1.1.3.import.bc -o - | FileCheck %s24source_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 any29@g = global i8 42, comdat, !type !030 31; CHECK: define available_externally dllimport ptr @f()32define available_externally dllimport i8* @f() {33 ret i8* @g34}35 36define i8* @e() {37 ret i8* @g38}39 40define i32 @main() {41 %1 = call i8* @f()42 %2 = ptrtoint i8* %1 to i3243 ret i32 %244}45!0 = !{i32 0, !"typeid"}46