| 1 |
// REQUIRES: x86-registered-target |
| 2 |
|
| 3 |
// RUN: split-file %s %t |
| 4 |
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -flto=thin -emit-llvm-bc %t/a.c -o %t/a.bc |
| 5 |
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -flto=thin -emit-llvm-bc %t/b.c -o %t/b.bc |
| 6 |
// RUN: llvm-nm %t/a.bc | FileCheck %s --check-prefix=NM |
| 7 |
|
| 8 |
// 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 |
| 9 |
// RUN: llvm-dis < %t/out.2.2.internalize.bc | FileCheck %s |
| 10 |
|
| 11 |
//--- a.c |
| 12 |
/// IR symtab does not track inline asm symbols, so we don't know |
| 13 |
/// ff_h264_cabac_tables is undefined. |
| 14 |
// NM-NOT: {{.}} |
| 15 |
// NM: ---------------- T ref |
| 16 |
// NM-NOT: {{.}} |
| 17 |
const char *ref(void) { |
| 18 |
const char *ret; |
| 19 |
asm("lea ff_h264_cabac_tables(%%rip), %0" : "=r"(ret)); |
| 20 |
return ret; |
| 21 |
} |
| 22 |
|
| 23 |
//--- b.c |
| 24 |
/// ff_h264_cabac_tables has __attribute__((used)) in the source code, which means |
| 25 |
/// its definition must be retained because there can be references the compiler |
| 26 |
/// cannot see (inline asm reference). Test we don't internalize it. |
| 27 |
// CHECK: @ff_h264_cabac_tables = dso_local constant [1 x i8] c"\09" |
| 28 |
__attribute__((used)) |
| 29 |
const char ff_h264_cabac_tables[1] = "\x09"; |