1; Check that non-prevailing symbols in module inline assembly are discarded 2; during regular LTO otherwise the final symbol binding could be wrong. 3 4; RUN: split-file %s %t 5; RUN: opt %t/t1.ll -o %t1 6; RUN: opt %t/t2.ll -o %t2 7; RUN: opt %t/t3.ll -o %t3 8; RUN: opt %t/t4.ll -o %t4 9 10; RUN: llvm-lto2 run -o %to1 -save-temps %t1 %t2 \ 11; RUN: -r %t1,foo,px \ 12; RUN: -r %t2,foo, \ 13; RUN: -r %t2,bar,pl 14; RUN: llvm-dis < %to1.0.0.preopt.bc | FileCheck %s --check-prefix=ASM1 15; RUN: llvm-nm %to1.0 | FileCheck %s --check-prefix=SYM 16; RUN: llvm-objdump -d --disassemble-symbols=foo %to1.0 \ 17; RUN: | FileCheck %s --check-prefix=DEF 18 19; RUN: llvm-lto2 run -o %to2 -save-temps %t2 %t3 \ 20; RUN: -r %t2,foo, \ 21; RUN: -r %t2,bar,pl \ 22; RUN: -r %t3,foo,px 23; RUN: llvm-dis < %to2.0.0.preopt.bc | FileCheck %s --check-prefix=ASM2 24; RUN: llvm-nm %to2.0 | FileCheck %s --check-prefix=SYM 25; RUN: llvm-objdump -d --disassemble-symbols=foo %to2.0 \ 26; RUN: | FileCheck %s --check-prefix=DEF 27 28; Check that ".symver" is properly handled. 29; RUN: llvm-lto2 run -o %to3 -save-temps %t4 \ 30; RUN: -r %t4,bar, \ 31; RUN: -r %t4,foo, \ 32; RUN: -r %t4,foo@@VER1,px 33; RUN: llvm-dis < %to3.0.0.preopt.bc | FileCheck %s --check-prefix=ASM3 34 35; ASM1: module asm ".lto_discard foo" 36; ASM1-NEXT: module asm ".weak foo" 37; ASM1-NEXT: module asm ".equ foo,bar" 38 39; ASM2: module asm ".lto_discard foo" 40; ASM2-NEXT: module asm ".weak foo" 41; ASM2-NEXT: module asm ".equ foo,bar" 42; ASM2-NEXT: module asm ".lto_discard" 43; ASM2-NEXT: module asm " .global foo ; foo: leal 2(%rdi), %eax" 44 45; ASM3-NOT: module asm ".lto_discard foo" 46 47; SYM: T foo 48 49; DEF: leal 2(%rdi), %eax 50 51;--- t1.ll 52target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" 53target triple = "x86_64-unknown-linux-gnu" 54 55define dso_local i32 @foo(i32 %0) { 56 %2 = add nsw i32 %0, 2 57 ret i32 %2 58} 59 60;--- t2.ll 61target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" 62target triple = "x86_64-unknown-linux-gnu" 63 64module asm ".weak foo" 65module asm ".equ foo,bar" 66 67@llvm.compiler.used = appending global [1 x i8*] [i8* bitcast (i32 (i32)* @bar to i8*)], section "llvm.metadata" 68 69define internal i32 @bar(i32 %0) { 70 %2 = add nsw i32 %0, 1 71 ret i32 %2 72} 73 74;--- t3.ll 75target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" 76target triple = "x86_64-unknown-linux-gnu" 77 78module asm " .global foo ; foo: leal 2(%rdi), %eax" 79 80;--- t4.ll 81target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" 82target triple = "x86_64-unknown-linux-gnu" 83 84module asm ".global foo" 85module asm "foo: call bar" 86module asm ".symver foo,foo@@@VER1" 87module asm ".symver bar,bar@@@VER1" 88