1 ; RUN: llvm-as < %s > %t1.bc 2 ; RUN: llvm-as < %p/Inputs/common2.ll > %t2.bc 3 4 ; Test that the common merging (size + alignment) is properly handled 5 6 ; Client marked the "large with little alignment" one as prevailing 7 ; RUN: llvm-lto2 run %t1.bc %t2.bc -o %t.o -save-temps \ 8 ; RUN: -r %t1.bc,v,x \ 9 ; RUN: -r %t2.bc,v,px \ 10 ; RUN: -r %t1.bc,foo,px \ 11 ; RUN: -r %t2.bc,bar,px 12 ; RUN: llvm-dis < %t.o.0.0.preopt.bc | FileCheck %s --check-prefix=LARGE-PREVAILED 13 14 ; Same as before, but reversing the order of the inputs 15 ; RUN: llvm-lto2 run %t2.bc %t1.bc -o %t.o -save-temps \ 16 ; RUN: -r %t1.bc,v,x \ 17 ; RUN: -r %t2.bc,v,px \ 18 ; RUN: -r %t1.bc,foo,px \ 19 ; RUN: -r %t2.bc,bar,px 20 ; RUN: llvm-dis < %t.o.0.0.preopt.bc | FileCheck %s --check-prefix=LARGE-PREVAILED 21 22 ; Client marked the "small with large alignment" one as prevailing 23 ; RUN: llvm-lto2 run %t1.bc %t2.bc -o %t.o -save-temps \ 24 ; RUN: -r %t1.bc,v,px \ 25 ; RUN: -r %t2.bc,v,x \ 26 ; RUN: -r %t1.bc,foo,px \ 27 ; RUN: -r %t2.bc,bar,px 28 ; RUN: llvm-dis < %t.o.0.0.preopt.bc | FileCheck %s --check-prefix=SMALL-PREVAILED 29 30 ; Same as before, but reversing the order of the inputs 31 ; RUN: llvm-lto2 run %t2.bc %t1.bc -o %t.o -save-temps \ 32 ; RUN: -r %t1.bc,v,px \ 33 ; RUN: -r %t2.bc,v,x \ 34 ; RUN: -r %t1.bc,foo,px \ 35 ; RUN: -r %t2.bc,bar,px 36 ; RUN: llvm-dis < %t.o.0.0.preopt.bc | FileCheck %s --check-prefix=SMALL-PREVAILED 37 38 39 ; Client didn't mark any as prevailing, we keep the first one we see as "external" 40 ; RUN: llvm-lto2 run %t1.bc %t2.bc -o %t.o -save-temps \ 41 ; RUN: -r %t1.bc,v,x \ 42 ; RUN: -r %t2.bc,v,x \ 43 ; RUN: -r %t1.bc,foo,px \ 44 ; RUN: -r %t2.bc,bar,px 45 ; RUN: llvm-dis < %t.o.0.0.preopt.bc | FileCheck %s --check-prefix=NONE-PREVAILED1 46 47 ; Same as before, but reversing the order of the inputs 48 ; RUN: llvm-lto2 run %t2.bc %t1.bc -o %t.o -save-temps \ 49 ; RUN: -r %t1.bc,v,x \ 50 ; RUN: -r %t2.bc,v,x \ 51 ; RUN: -r %t1.bc,foo,px \ 52 ; RUN: -r %t2.bc,bar,px 53 ; RUN: llvm-dis < %t.o.0.0.preopt.bc | FileCheck %s --check-prefix=NONE-PREVAILED2 54 55 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 56 target triple = "x86_64-unknown-linux-gnu" 57 58 @v = common global i8 0, align 8 59 60 ; LARGE-PREVAILED: @v = common global i16 0, align 8 61 ; SMALL-PREVAILED: @v = common global [2 x i8] zeroinitializer, align 8 62 ; BOTH-PREVAILED1: @v = common global i16 0, align 8 63 ; BOTH-PREVAILED2: common global [2 x i8] zeroinitializer, align 8 64 ; In this case the first is kept as external 65 ; NONE-PREVAILED1: @v = external global i8, align 8 66 ; NONE-PREVAILED2: @v = external global i16, align 4 67 68 define i8 *@foo() { 69 ret i8 *@v 70 } 71