Skip to content

Commit dff84ee

Browse files
dlei6gsys_zuul
authored andcommitted
Updates indirect call attributes for function pointer calls
Change-Id: I3e6bc8c73feafcb42e6ee475d8e249e27e041141
1 parent 3a41c2a commit dff84ee

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

IGC/AdaptorCommon/AddImplicitArgs.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -640,12 +640,15 @@ void AddImplicitArgs::FixIndirectCalls(Module& M)
640640

641641
IRBuilder<> builder(call);
642642
Value* funcPtr = call->getCalledValue();
643-
PointerType* funcTy = PointerType::get(FunctionType::get(call->getType(), argTys, false), 0);
643+
unsigned fAS = funcPtr->getType()->getPointerAddressSpace();
644+
PointerType* funcTy = PointerType::get(FunctionType::get(call->getType(), argTys, false), fAS);
644645
funcPtr = builder.CreatePointerBitCastOrAddrSpaceCast(funcPtr, funcTy);
645646
CallInst* newCall = builder.CreateCall(funcPtr, args);
646647

647-
call->replaceAllUsesWith(newCall);
648648
newCall->copyMetadata(*call);
649+
newCall->setCallingConv(call->getCallingConv());
650+
newCall->setAttributes(call->getAttributes());
651+
call->replaceAllUsesWith(newCall);
649652
list_delete.push_back(call);
650653
}
651654
}

0 commit comments

Comments
 (0)