Skip to content

Commit a2032c3

Browse files
PawelJureksys_zuul
authored and
sys_zuul
committed
Allow user annotations for non-kernel functions.
Change-Id: Iec3de908d52a650df42725a5cc1ecfac60907310
1 parent e3cf0a2 commit a2032c3

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp

+8-6
Original file line numberDiff line numberDiff line change
@@ -3575,6 +3575,14 @@ SPIRVToLLVM::transKernelMetadata()
35753575
SPIRVFunction *BF = BM->getFunction(I);
35763576
Function *F = static_cast<Function *>(getTranslatedValue(BF));
35773577
assert(F && "Invalid translated function");
3578+
3579+
// __attribute__((annotate("some_user_annotation"))) are passed via
3580+
// UserSemantic decoration on functions.
3581+
if (BF->hasDecorate(DecorationUserSemantic)) {
3582+
auto &funcInfo = MD.FuncMD[F];
3583+
funcInfo.UserAnnotations = BF->getDecorationStringLiteral(DecorationUserSemantic);
3584+
}
3585+
35783586
if (F->getCallingConv() != CallingConv::SPIR_KERNEL || F->isDeclaration())
35793587
continue;
35803588
std::vector<llvm::Metadata*> KernelMD;
@@ -3739,12 +3747,6 @@ SPIRVToLLVM::transKernelMetadata()
37393747
}
37403748
}
37413749

3742-
// __attribute__((annotate("some_user_annotation"))) are passed via
3743-
// UserSemantic decoration on functions.
3744-
if (BF->hasDecorate(DecorationUserSemantic)) {
3745-
funcInfo.UserAnnotations = BF->getDecorationStringLiteral(DecorationUserSemantic);
3746-
}
3747-
37483750
llvm::MDNode *Node = MDNode::get(*Context, KernelMD);
37493751
KernelMDs->addOperand(Node);
37503752
}

0 commit comments

Comments
 (0)