================ @@ -5911,31 +5911,21 @@ bool llvm::omp::isOpenMPKernel(Function &Fn) { KernelSet llvm::omp::getDeviceKernels(Module &M) { // TODO: Create a more cross-platform way of determining device kernels. - NamedMDNode *MD = M.getNamedMetadata("nvvm.annotations"); KernelSet Kernels; - if (!MD) - return Kernels; - - for (auto *Op : MD->operands()) { - if (Op->getNumOperands() < 2) - continue; - MDString *KindID = dyn_cast<MDString>(Op->getOperand(1)); - if (!KindID || KindID->getString() != "kernel") - continue; - - Function *KernelFn = - mdconst::dyn_extract_or_null<Function>(Op->getOperand(0)); - if (!KernelFn) - continue; - - // We are only interested in OpenMP target regions. Others, such as kernels - // generated by CUDA but linked together, are not interesting to this pass. - if (isOpenMPKernel(*KernelFn)) { - ++NumOpenMPTargetRegionKernels; - Kernels.insert(KernelFn); - } else - ++NumNonOpenMPTargetRegionKernels; + for (auto &F : M) { + // TODO: unify this check with isKernelFunction in NVPTXUtilities. + if (F.hasFnAttribute("nvvm.kernel")) { + ---------------- AlexMaclean wrote:
Fixed https://github.com/llvm/llvm-project/pull/119261 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits