File tree Expand file tree Collapse file tree 3 files changed +36
-3
lines changed Expand file tree Collapse file tree 3 files changed +36
-3
lines changed Original file line number Diff line number Diff line change @@ -2873,8 +2873,8 @@ Error BitcodeReader::resolveGlobalAndIndirectSymbolInits() {
2873
2873
Type *ResolverFTy =
2874
2874
GlobalIFunc::getResolverFunctionType (GI->getValueType ());
2875
2875
// Transparently fix up the type for compatibility with older bitcode
2876
- GI->setResolver (
2877
- ConstantExpr::getBitCast ( C, ResolverFTy->getPointerTo ()));
2876
+ GI->setResolver (ConstantExpr::getBitCast (
2877
+ C, ResolverFTy->getPointerTo (GI-> getAddressSpace () )));
2878
2878
} else {
2879
2879
return error (" Expected an alias or an ifunc" );
2880
2880
}
Original file line number Diff line number Diff line change @@ -889,7 +889,7 @@ void Verifier::visitGlobalIFunc(const GlobalIFunc &GI) {
889
889
const Type *ResolverTy = GI.getResolver ()->getType ();
890
890
const Type *ResolverFuncTy =
891
891
GlobalIFunc::getResolverFunctionType (GI.getValueType ());
892
- Check (ResolverTy == ResolverFuncTy->getPointerTo (),
892
+ Check (ResolverTy == ResolverFuncTy->getPointerTo (GI. getAddressSpace () ),
893
893
" IFunc resolver has incorrect type" , &GI);
894
894
}
895
895
Original file line number Diff line number Diff line change
1
+ ; RUN: llvm-as < %s | llvm-dis | FileCheck %s
2
+
3
+ target datalayout = "P1"
4
+
5
+ ; CHECK: @ifunc_as0 = ifunc void (), ptr @resolver_as0
6
+ @ifunc_as0 = ifunc void (), ptr @resolver_as0
7
+
8
+ ; CHECK: @ifunc_as1 = ifunc void (), ptr addrspace(1) @resolver_as1
9
+ @ifunc_as1 = ifunc void (), ptr addrspace (1 ) @resolver_as1
10
+
11
+ ; CHECK: define ptr @resolver_as0() addrspace(0) {
12
+ define ptr @resolver_as0 () addrspace (0 ) {
13
+ ret ptr null
14
+ }
15
+
16
+ ; CHECK: define ptr @resolver_as1() addrspace(1) {
17
+ define ptr @resolver_as1 () addrspace (1 ) {
18
+ ret ptr null
19
+ }
20
+
21
+ ; CHECK: define void @call_ifunc_as0() addrspace(1) {
22
+ ; CHECK-NEXT: call addrspace(0) void @ifunc_as0()
23
+ define void @call_ifunc_as0 () addrspace (1 ) {
24
+ call addrspace (0 ) void @ifunc_as0 ()
25
+ ret void
26
+ }
27
+
28
+ ; CHECK: define void @call_ifunc_as1() addrspace(1) {
29
+ ; CHECK-NEXT: call addrspace(1) void @ifunc_as1()
30
+ define void @call_ifunc_as1 () addrspace (1 ) {
31
+ call addrspace (1 ) void @ifunc_as1 ()
32
+ ret void
33
+ }
You can’t perform that action at this time.
0 commit comments