xref: /llvm-project/llvm/test/ThinLTO/X86/asm.ll (revision d5d3eb16b7ab72529c83dacb2889811491e48909)
1; RUN: split-file %s %t
2; RUN: opt -module-summary %t/a.s -o %t/a.bc
3; RUN: opt -module-summary %t/b.s -o %t/b.bc
4; RUN: llvm-nm %t/a.bc | FileCheck %s --check-prefix=NM
5
6; RUN: llvm-lto2 run %t/a.bc %t/b.bc -o %t/out -save-temps -r=%t/a.bc,ref,plx -r=%t/b.bc,ff_h264_cabac_tables,pl
7; RUN: llvm-dis < %t/out.2.2.internalize.bc | FileCheck %s
8
9;--- a.s
10;; IR symtab does not track inline asm symbols, so we don't know
11;; ff_h264_cabac_tables is undefined.
12; NM-NOT: {{.}}
13; NM:     ---------------- T ref
14; NM-NOT: {{.}}
15target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
16target triple = "x86_64-unknown-linux-gnu"
17
18define ptr @ref() {
19entry:
20  %0 = tail call ptr asm sideeffect "lea ff_h264_cabac_tables(%rip), $0", "=&r,~{dirflag},~{fpsr},~{flags}"()
21  ret ptr %0
22}
23
24;--- b.s
25target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
26target triple = "x86_64-unknown-linux-gnu"
27
28;; ff_h264_cabac_tables has __attribute__((used)) in the source code, which means
29;; its definition must be retained because there can be references the compiler
30;; cannot see (inline asm reference). Test we don't internalize it.
31; CHECK: @ff_h264_cabac_tables = dso_local constant [1 x i8] c"\09"
32@ff_h264_cabac_tables = dso_local constant [1 x i8] c"\09"
33
34@llvm.compiler.used = appending global [1 x ptr] [ptr @ff_h264_cabac_tables], section "llvm.metadata"
35