[cfe-commits] r165343 - in /cfe/trunk: lib/CodeGen/CodeGenModule.cpp test/CodeGen/alias.c
Alex Rosenberg
alexr at leftfield.org
Fri Oct 5 16:12:54 PDT 2012
Author: alexr
Date: Fri Oct 5 18:12:53 2012
New Revision: 165343
URL: http://llvm.org/viewvc/llvm-project?rev=165343&view=rev
Log:
Propagate calling convention for aliases and weakrefs.
Modified:
cfe/trunk/lib/CodeGen/CodeGenModule.cpp
cfe/trunk/test/CodeGen/alias.c
Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=165343&r1=165342&r2=165343&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Fri Oct 5 18:12:53 2012
@@ -843,7 +843,8 @@
llvm::Constant *Aliasee;
if (isa<llvm::FunctionType>(DeclTy))
- Aliasee = GetOrCreateLLVMFunction(AA->getAliasee(), DeclTy, GlobalDecl(),
+ Aliasee = GetOrCreateLLVMFunction(AA->getAliasee(), DeclTy,
+ GlobalDecl(cast<FunctionDecl>(VD)),
/*ForVTable=*/false);
else
Aliasee = GetOrCreateLLVMGlobal(AA->getAliasee(),
@@ -1929,7 +1930,7 @@
// if a deferred decl.
llvm::Constant *Aliasee;
if (isa<llvm::FunctionType>(DeclTy))
- Aliasee = GetOrCreateLLVMFunction(AA->getAliasee(), DeclTy, GlobalDecl(),
+ Aliasee = GetOrCreateLLVMFunction(AA->getAliasee(), DeclTy, GD,
/*ForVTable=*/false);
else
Aliasee = GetOrCreateLLVMGlobal(AA->getAliasee(),
Modified: cfe/trunk/test/CodeGen/alias.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/alias.c?rev=165343&r1=165342&r2=165343&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/alias.c (original)
+++ cfe/trunk/test/CodeGen/alias.c Fri Oct 5 18:12:53 2012
@@ -1,24 +1,25 @@
-// RUN: %clang_cc1 -triple i386-pc-linux-gnu -emit-llvm -o - %s | FileCheck %s
+// 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
int g0;
-// CHECK: @g0 = common global i32 0
+// CHECKBASIC: @g0 = common global i32 0
static int bar1 = 42;
-// CHECK: @bar1 = internal global i32 42
+// CHECKBASIC: @bar1 = internal global i32 42
extern int g1;
extern int g1 __attribute((alias("g0")));
-// CHECK: @g1 = alias i32* @g0
+// CHECKBASIC: @g1 = alias i32* @g0
void f0(void) { }
extern void f1(void);
extern void f1(void) __attribute((alias("f0")));
-// CHECK: @f1 = alias void ()* @f0
-// CHECK: define void @f0() nounwind {
+// CHECKBASIC: @f1 = alias void ()* @f0
+// CHECKBASIC: define void @f0() nounwind {
// Make sure that aliases cause referenced values to be emitted.
// PR3200
static inline int foo1() { return 0; }
-// CHECK: define internal i32 @foo1()
+// CHECKBASIC: define internal i32 @foo1()
int foo() __attribute__((alias("foo1")));
int bar() __attribute__((alias("bar1")));
@@ -28,3 +29,18 @@
// test6 changes to alias.
int test6() __attribute__((alias("test7")));
+static int inner(int a) { return 0; }
+static int inner_weak(int a) { return 0; }
+extern __typeof(inner) inner_a __attribute__((alias("inner")));
+static __typeof(inner_weak) inner_weak_a __attribute__((weakref, alias("inner_weak")));
+// CHECKCC: @inner_a = alias i32 (i32)* @inner
+// CHECKCC: define internal arm_aapcs_vfpcc i32 @inner(i32 %a) nounwind {
+
+int outer(int a) { return inner(a); }
+// CHECKCC: define arm_aapcs_vfpcc i32 @outer(i32 %a) nounwind {
+// CHECKCC: %call = call arm_aapcs_vfpcc i32 @inner(i32 %0)
+
+int outer_weak(int a) { return inner_weak_a(a); }
+// CHECKCC: define arm_aapcs_vfpcc i32 @outer_weak(i32 %a) nounwind {
+// CHECKCC: %call = call arm_aapcs_vfpcc i32 @inner_weak(i32 %0)
+// CHECKCC: define internal arm_aapcs_vfpcc i32 @inner_weak(i32 %a) nounwind {
More information about the cfe-commits
mailing list