Skip to content

Commit 8fef8d7

Browse files
committed
removed declarations processing since the pass should clone kernel functions
1 parent 5487681 commit 8fef8d7

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

lib/Target/AMDGPU/AMDGPULowerKernelCalls.cpp

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -67,18 +67,10 @@ static void setNameForBody(Function *FBody, const Function &FKernel) {
6767
FBody->setName(NewName.str());
6868
}
6969

70-
static Function *copyDeclaration(const Function &F) {
71-
Function *NewF = Function::Create(F.getFunctionType(), F.getLinkage());
72-
NewF->setAttributes(F.getAttributes());
73-
return NewF;
74-
}
75-
7670
static Function *cloneKernel(Function &F) {
7771
ValueToValueMapTy ignored;
78-
Function *NewF =
79-
F.empty() ? copyDeclaration(F) : CloneFunction(&F, ignored, false);
80-
F.getParent()->getOrInsertFunction(NewF->getName(), NewF->getFunctionType(),
81-
NewF->getAttributes());
72+
assert(!F.isDeclaration() && "called kernel function should have a body");
73+
Function *NewF = CloneFunction(&F, ignored, false);
8274
NewF->setCallingConv(CallingConv::C);
8375
setNameForBody(NewF, F);
8476
return NewF;

0 commit comments

Comments
 (0)