1; Check that we internalize external constant if it is accessed 2; purely by non-volatile loads. 3; RUN: opt -thinlto-bc %s -o %t-main 4; RUN: opt -thinlto-bc %p/Inputs/import-ro-constant-foo.ll -o %t-foo 5; RUN: opt -thinlto-bc %p/Inputs/import-ro-constant-bar.ll -o %t-bar 6; RUN: llvm-lto2 run -save-temps -o %t-out %t-main %t-foo %t-bar \ 7; RUN: -r=%t-foo,foo,pl \ 8; RUN: -r=%t-main,main,plx \ 9; RUN: -r=%t-main,_Z3barv,l \ 10; RUN: -r=%t-main,foo, \ 11; RUN: -r=%t-bar,_Z3barv,pl \ 12; RUN: -r=%t-bar,foo, 13; RUN: llvm-dis %t-out.1.3.import.bc -o - | FileCheck %s --check-prefix=IMPORT 14; RUN: llvm-dis %t-out.1.4.opt.bc -o - | FileCheck %s --check-prefix=OPT 15 16; IMPORT: @foo = internal local_unnamed_addr constant i32 21, align 4 #0 17; IMPORT: attributes #0 = { "thinlto-internalize" } 18; OPT: i32 @main() 19; OPT-NEXT: entry: 20; OPT-NEXT: ret i32 42 21 22source_filename = "main.c" 23target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" 24target triple = "x86_64-unknown-linux-gnu" 25 26@foo = external dso_local local_unnamed_addr constant i32, align 4 27define dso_local i32 @main() local_unnamed_addr { 28entry: 29 %0 = load i32, ptr @foo, align 4 30 %call = tail call i32 @_Z3barv() 31 %add = add nsw i32 %call, %0 32 ret i32 %add 33} 34declare dso_local i32 @_Z3barv() local_unnamed_addr 35