Skip to content

Commit c4ea9e6

Browse files
MAGoncharovigcbot
authored andcommitted
Copy metadata in GenXArgIndirection.
Creating new function, metadata must not disappear.
1 parent 68999a6 commit c4ea9e6

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

IGC/VectorCompiler/lib/GenXCodeGen/GenXArgIndirection.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ SPDX-License-Identifier: MIT
146146

147147
#include "vc/GenXOpts/Utils/KernelInfo.h"
148148
#include "vc/Utils/GenX/RegCategory.h"
149+
#include "vc/Utils/General/FunctionAttrs.h"
149150

150151
#include "llvm/GenXIntrinsics/GenXIntrinsics.h"
151152
#include "llvm/GenXIntrinsics/GenXMetadata.h"
@@ -1252,9 +1253,9 @@ std::pair<Value *, Value *> SubroutineArg::addAddressArg() {
12521253
ArgTys.push_back(Type::getInt16Ty(F->getContext()));
12531254
FTy = FunctionType::get(FTy->getReturnType(), ArgTys, false);
12541255
// Create the new function.
1255-
NewFunc = Function::Create(FTy, F->getLinkage(), "");
1256-
NewFunc->takeName(F);
1257-
NewFunc->copyAttributesFrom(F);
1256+
NewFunc = Function::Create(FTy, F->getLinkage(), F->getName());
1257+
vc::transferNameAndCCWithNewAttr(F->getAttributes(), *F, *NewFunc);
1258+
vc::transferDISubprogram(*F, *NewFunc);
12581259
F->getParent()->getFunctionList().insert(F->getIterator(), NewFunc);
12591260
// Set the new function's number to the same as the old function.
12601261
Pass->Numbering->setNumber(NewFunc, Pass->Numbering->getNumber(F));

0 commit comments

Comments
 (0)