Add test for PR24379

The fix for this is in LLVM but it depends on how clang handles the alias
attribute, so add a test to the clang tests to make sure everything works
together as expected.

Differential Revision: http://reviews.llvm.org/D11980

llvm-svn: 244756
This commit is contained in:
John Brawn 2015-08-12 15:15:27 +00:00
parent 2366168bad
commit 495008edde
1 changed files with 25 additions and 2 deletions

View File

@ -1,19 +1,42 @@
// RUN: %clang_cc1 -triple i386-pc-linux-gnu -emit-llvm -o - %s | FileCheck -check-prefix=CHECKBASIC %s
// RUN: %clang_cc1 -triple armv7a-eabi -mfloat-abi hard -emit-llvm -o - %s | FileCheck -check-prefix=CHECKCC %s
// RUN: %clang_cc1 -triple armv7a-eabi -mfloat-abi hard -S -o - %s | FileCheck -check-prefix=CHECKASM %s
int g0;
// CHECKBASIC: @g0 = common global i32 0
// CHECKBASIC-DAG: @g0 = common global i32 0
// CHECKASM-DAG: .comm g0,4,4
__thread int TL_WITH_ALIAS;
// CHECKBASIC-DAG: @TL_WITH_ALIAS = thread_local global i32 0, align 4
// CHECKASM-DAG: .globl TL_WITH_ALIAS
// CHECKASM-DAG: .size TL_WITH_ALIAS, 4
static int bar1 = 42;
// CHECKBASIC: @bar1 = internal global i32 42
// CHECKBASIC-DAG: @bar1 = internal global i32 42
// CHECKASM-DAG: bar1:
// CHECKASM-DAG: .size bar1, 4
// PR24379: alias variable expected to have same size as aliasee even when types differ
const int wacom_usb_ids[] = {1, 1, 2, 3, 5, 8, 13, 0};
// CHECKBASIC-DAG: @wacom_usb_ids = constant [8 x i32] [i32 1, i32 1, i32 2, i32 3, i32 5, i32 8, i32 13, i32 0], align 4
// CHECKASM-DAG: .globl wacom_usb_ids
// CHECKASM-DAG: .size wacom_usb_ids, 32
extern const int __mod_usb_device_table __attribute__ ((alias("wacom_usb_ids")));
// CHECKBASIC-DAG: @__mod_usb_device_table = alias getelementptr inbounds ([8 x i32], [8 x i32]* @wacom_usb_ids, i32 0, i32 0)
// CHECKASM-DAG: .globl __mod_usb_device_table
// CHECKASM-DAG: __mod_usb_device_table = wacom_usb_ids
// CHECKASM-DAG-NOT: .size __mod_usb_device_table
extern int g1;
extern int g1 __attribute((alias("g0")));
// CHECKBASIC-DAG: @g1 = alias i32* @g0
// CHECKASM-DAG: .globl g1
// CHECKASM-DAG: g1 = g0
// CHECKASM-DAG-NOT: .size g1
extern __thread int __libc_errno __attribute__ ((alias ("TL_WITH_ALIAS")));
// CHECKBASIC-DAG: @__libc_errno = thread_local alias i32* @TL_WITH_ALIAS
// CHECKASM-DAG: .globl __libc_errno
// CHECKASM-DAG: __libc_errno = TL_WITH_ALIAS
// CHECKASM-DAG-NOT: .size __libc_errno
void f0(void) { }
extern void f1(void);