52 lines · plain
1; Test to ensure that we always select the same copy of a linkonce function2; when it is encountered with different thresholds. When we encounter the3; copy in funcimport_resolved1.ll with a higher threshold via the direct call4; from main(), it will be selected for importing. When we encounter it with a5; lower threshold by reaching it from the deeper call chain via foo(), it6; won't be selected for importing. We don't want to select both the copy from7; funcimport_resolved1.ll and the smaller one from funcimport_resolved2.ll,8; leaving it up to the backend to figure out which one to actually import.9; The linkonce_odr may have different instruction counts in practice due to10; different inlines in the compile step.11 12; Require asserts so we can use -debug-only13; REQUIRES: asserts14 15; REQUIRES: x86-registered-target16 17; RUN: opt -module-summary %s -o %t.bc18; RUN: opt -module-summary %p/Inputs/funcimport_resolved1.ll -o %t2.bc19; RUN: opt -module-summary %p/Inputs/funcimport_resolved2.ll -o %t3.bc20 21; First verify that all callees are imported with the default instruction limit22; RUN: llvm-lto2 run %t.bc %t2.bc %t3.bc -o %t4 -r=%t.bc,_main,pl -r=%t.bc,_linkonceodrfunc,l -r=%t.bc,_foo,l -r=%t2.bc,_foo,pl -r=%t2.bc,_linkonceodrfunc,pl -r=%t2.bc,_linkonceodrfunc2,pl -r=%t3.bc,_linkonceodrfunc,l -thinlto-threads=1 -debug-only=function-import 2>&1 | FileCheck %s --check-prefix=INSTLIMDEFAULT23; INSTLIMDEFAULT: Is importing function {{.*}} foo from {{.*}}funcimport_resolved1.ll24; INSTLIMDEFAULT: Is importing function {{.*}} linkonceodrfunc from {{.*}}funcimport_resolved1.ll25; INSTLIMDEFAULT: Is importing function {{.*}} linkonceodrfunc2 from {{.*}}funcimport_resolved1.ll26; INSTLIMDEFAULT: Is importing function {{.*}} f from {{.*}}funcimport_resolved1.ll27; INSTLIMDEFAULT-NOT: Is importing function {{.*}} linkonceodrfunc from {{.*}}funcimport_resolved2.ll28 29; Now run with the lower threshold that will only allow linkonceodrfunc to be30; imported from funcimport_resolved1.ll when encountered via the direct call31; from main(). Ensure we don't also select the copy in funcimport_resolved2.ll32; when it is encountered via the deeper call chain.33; RUN: llvm-lto2 run %t.bc %t2.bc %t3.bc -o %t4 -r=%t.bc,_main,pl -r=%t.bc,_linkonceodrfunc,l -r=%t.bc,_foo,l -r=%t2.bc,_foo,pl -r=%t2.bc,_linkonceodrfunc,pl -r=%t2.bc,_linkonceodrfunc2,pl -r=%t3.bc,_linkonceodrfunc,l -thinlto-threads=1 -debug-only=function-import -import-instr-limit=8 2>&1 | FileCheck %s --check-prefix=INSTLIM834; INSTLIM8: Is importing function {{.*}} foo from {{.*}}funcimport_resolved1.ll35; INSTLIM8: Is importing function {{.*}} linkonceodrfunc from {{.*}}funcimport_resolved1.ll36; INSTLIM8: Not importing function {{.*}} linkonceodrfunc2 from {{.*}}funcimport_resolved1.ll37; INSTLIM8: Is importing function {{.*}} f from {{.*}}funcimport_resolved1.ll38; INSTLIM8-NOT: Is importing function {{.*}} linkonceodrfunc from {{.*}}funcimport_resolved2.ll39 40target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"41target triple = "x86_64-apple-macosx10.11.0"42 43define i32 @main() #0 {44entry:45 call void (...) @foo()46 call void (...) @linkonceodrfunc()47 ret i32 048}49 50declare void @foo(...) #151declare void @linkonceodrfunc(...) #152