88 lines · plain
1; Check that non-prevailing symbols in module inline assembly are discarded2; during regular LTO otherwise the final symbol binding could be wrong.3 4; RUN: split-file %s %t5; RUN: opt %t/t1.ll -o %t16; RUN: opt %t/t2.ll -o %t27; RUN: opt %t/t3.ll -o %t38; RUN: opt %t/t4.ll -o %t49 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,pl14; RUN: llvm-dis < %to1.0.0.preopt.bc | FileCheck %s --check-prefix=ASM115; RUN: llvm-nm %to1.0 | FileCheck %s --check-prefix=SYM16; RUN: llvm-objdump --no-print-imm-hex -d --disassemble-symbols=foo %to1.0 \17; RUN: | FileCheck %s --check-prefix=DEF18 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,px23; RUN: llvm-dis < %to2.0.0.preopt.bc | FileCheck %s --check-prefix=ASM224; RUN: llvm-nm %to2.0 | FileCheck %s --check-prefix=SYM25; RUN: llvm-objdump --no-print-imm-hex -d --disassemble-symbols=foo %to2.0 \26; RUN: | FileCheck %s --check-prefix=DEF27 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,px33; RUN: llvm-dis < %to3.0.0.preopt.bc | FileCheck %s --check-prefix=ASM334 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 foo48 49; DEF: leal 2(%rdi), %eax50 51;--- t1.ll52target 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, 257 ret i32 %258}59 60;--- t2.ll61target 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 ptr] [ptr @bar], section "llvm.metadata"68 69define internal i32 @bar(i32 %0) {70 %2 = add nsw i32 %0, 171 ret i32 %272}73 74;--- t3.ll75target 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.ll81target 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