1;; Test to ensure that we don't assert when checking variable importing 2;; correctness for read only variables where the importing module contains 3;; a linkonce_odr copy of the variable. In that case we do not need to 4;; import the read only variable even when it has been exported from its 5;; original module (in this case when we decided to import @bar). 6 7; RUN: split-file %s %t 8; RUN: opt -module-summary %t/foo.ll -o %t/foo.o 9; RUN: opt -module-summary %t/bar.ll -o %t/bar.o 10; RUN: llvm-lto2 run %t/foo.o %t/bar.o -r=%t/foo.o,foo,pl -r=%t/foo.o,bar,l -r=%t/foo.o,qux,pl -r=%t/bar.o,bar,pl -r=%t/bar.o,qux, -o %t.out -save-temps 11; RUN: llvm-dis %t.out.1.3.import.bc -o - | FileCheck %s 12 13;; Check that we have internalized @qux (since it is read only), and imported @bar. 14; CHECK: @qux = internal global i32 0 15; CHECK: define available_externally hidden void @bar() 16 17;--- foo.ll 18 19target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" 20target triple = "x86_64-unknown-linux-gnu" 21 22@qux = linkonce_odr hidden global i32 0 23 24define linkonce_odr hidden void @foo() { 25 call void @bar() 26 ret void 27} 28 29declare hidden void @bar() 30 31;--- bar.ll 32 33target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" 34target triple = "x86_64-unknown-linux-gnu" 35 36@qux = linkonce_odr hidden global i32 0 37 38define hidden void @bar() { 39 %1 = load i32, i32* @qux, align 8 40 ret void 41} 42