1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -triple i386-pc-linux-gnu -emit-llvm -o - %s | FileCheck -check-prefix=CHECKBASIC %s 2*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -triple armv7a-eabi -mfloat-abi hard -emit-llvm -o - %s | FileCheck -check-prefix=CHECKCC %s 3*f4a2713aSLionel Sambuc 4*f4a2713aSLionel Sambuc int g0; 5*f4a2713aSLionel Sambuc // CHECKBASIC: @g0 = common global i32 0 6*f4a2713aSLionel Sambuc static int bar1 = 42; 7*f4a2713aSLionel Sambuc // CHECKBASIC: @bar1 = internal global i32 42 8*f4a2713aSLionel Sambuc 9*f4a2713aSLionel Sambuc extern int g1; 10*f4a2713aSLionel Sambuc extern int g1 __attribute((alias("g0"))); 11*f4a2713aSLionel Sambuc // CHECKBASIC-DAG: @g1 = alias i32* @g0 12*f4a2713aSLionel Sambuc 13*f4a2713aSLionel Sambuc void f0(void) { } 14*f4a2713aSLionel Sambuc extern void f1(void); 15*f4a2713aSLionel Sambuc extern void f1(void) __attribute((alias("f0"))); 16*f4a2713aSLionel Sambuc // CHECKBASIC-DAG: @f1 = alias void ()* @f0 17*f4a2713aSLionel Sambuc // CHECKBASIC: define void @f0() [[NUW:#[0-9]+]] { 18*f4a2713aSLionel Sambuc 19*f4a2713aSLionel Sambuc // Make sure that aliases cause referenced values to be emitted. 20*f4a2713aSLionel Sambuc // PR3200 21*f4a2713aSLionel Sambuc static inline int foo1() { return 0; } 22*f4a2713aSLionel Sambuc // CHECKBASIC-LABEL: define internal i32 @foo1() 23*f4a2713aSLionel Sambuc int foo() __attribute__((alias("foo1"))); 24*f4a2713aSLionel Sambuc int bar() __attribute__((alias("bar1"))); 25*f4a2713aSLionel Sambuc 26*f4a2713aSLionel Sambuc extern int test6(); 27*f4a2713aSLionel Sambuc void test7() { test6(); } // test6 is emitted as extern. 28*f4a2713aSLionel Sambuc 29*f4a2713aSLionel Sambuc // test6 changes to alias. 30*f4a2713aSLionel Sambuc int test6() __attribute__((alias("test7"))); 31*f4a2713aSLionel Sambuc 32*f4a2713aSLionel Sambuc static int inner(int a) { return 0; } 33*f4a2713aSLionel Sambuc static int inner_weak(int a) { return 0; } 34*f4a2713aSLionel Sambuc extern __typeof(inner) inner_a __attribute__((alias("inner"))); 35*f4a2713aSLionel Sambuc static __typeof(inner_weak) inner_weak_a __attribute__((weakref, alias("inner_weak"))); 36*f4a2713aSLionel Sambuc // CHECKCC: @inner_a = alias i32 (i32)* @inner 37*f4a2713aSLionel Sambuc // CHECKCC: define internal arm_aapcs_vfpcc i32 @inner(i32 %a) [[NUW:#[0-9]+]] { 38*f4a2713aSLionel Sambuc 39*f4a2713aSLionel Sambuc int outer(int a) { return inner(a); } 40*f4a2713aSLionel Sambuc // CHECKCC: define arm_aapcs_vfpcc i32 @outer(i32 %a) [[NUW]] { 41*f4a2713aSLionel Sambuc // CHECKCC: call arm_aapcs_vfpcc i32 @inner(i32 %{{.*}}) 42*f4a2713aSLionel Sambuc 43*f4a2713aSLionel Sambuc int outer_weak(int a) { return inner_weak_a(a); } 44*f4a2713aSLionel Sambuc // CHECKCC: define arm_aapcs_vfpcc i32 @outer_weak(i32 %a) [[NUW]] { 45*f4a2713aSLionel Sambuc // CHECKCC: call arm_aapcs_vfpcc i32 @inner_weak(i32 %{{.*}}) 46*f4a2713aSLionel Sambuc // CHECKCC: define internal arm_aapcs_vfpcc i32 @inner_weak(i32 %a) [[NUW]] { 47*f4a2713aSLionel Sambuc 48*f4a2713aSLionel Sambuc // CHECKBASIC: attributes [[NUW]] = { nounwind{{.*}} } 49*f4a2713aSLionel Sambuc 50*f4a2713aSLionel Sambuc // CHECKCC: attributes [[NUW]] = { nounwind{{.*}} } 51