llvm.org GIT mirror llvm / 700eb26
Merging r310543: ------------------------------------------------------------------------ r310543 | pcc | 2017-08-09 18:07:44 -0700 (Wed, 09 Aug 2017) | 9 lines Linker: Create a function declaration when moving a non-prevailing alias of function type. We were previously creating a global variable of function type, which is invalid IR. This issue was exposed by r304690, in which we started asserting that global variables were of a valid type. Fixes PR33462. Differential Revision: https://reviews.llvm.org/D36438 ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_50@318181 91177308-0d34-0410-b5e6-96231b3b80d8 Tom Stellard 1 year, 9 months ago
2 changed file(s) with 21 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
639639 } else {
640640 if (ForDefinition)
641641 NewGV = copyGlobalAliasProto(cast(SGV));
642 else if (SGV->getValueType()->isFunctionTy())
643 NewGV =
644 Function::Create(cast(TypeMap.get(SGV->getValueType())),
645 GlobalValue::ExternalLinkage, SGV->getName(), &DstM);
642646 else
643647 NewGV = new GlobalVariable(
644648 DstM, TypeMap.get(SGV->getValueType()),
0 ; RUN: llvm-as -o %t %s
1 ; RUN: llvm-lto2 run %t -r %t,foo, -r %t,baz,p -o %t2 -save-temps
2 ; RUN: llvm-dis -o - %t2.0.0.preopt.bc | FileCheck %s
3
4 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
5 target triple = "x86_64--fuchsia"
6
7 ; CHECK: declare void @foo()
8 @foo = weak alias void(), void()* @bar
9
10 define internal void @bar() {
11 ret void
12 }
13
14 define void()* @baz() {
15 ret void()* @foo
16 }