File tree Expand file tree Collapse file tree 1 file changed +4
-24
lines changed Expand file tree Collapse file tree 1 file changed +4
-24
lines changed Original file line number Diff line number Diff line change @@ -5906,39 +5906,19 @@ bool llvm::omp::isOpenMPKernel(Function &Fn) {
59065906}
59075907
59085908KernelSet llvm::omp::getDeviceKernels (Module &M) {
5909- // TODO: Create a more cross-platform way of determining device kernels.
59105909 KernelSet Kernels;
59115910
5912- DenseSet<const Function *> SeenKernels;
5913- auto ProcessKernel = [&](Function &KF) {
5914- if (SeenKernels.insert (&KF).second ) {
5911+ for (Function &F : M)
5912+ if (F.hasKernelCallingConv ()) {
59155913 // We are only interested in OpenMP target regions. Others, such as
59165914 // kernels generated by CUDA but linked together, are not interesting to
59175915 // this pass.
5918- if (isOpenMPKernel (KF )) {
5916+ if (isOpenMPKernel (F )) {
59195917 ++NumOpenMPTargetRegionKernels;
5920- Kernels.insert (&KF );
5918+ Kernels.insert (&F );
59215919 } else
59225920 ++NumNonOpenMPTargetRegionKernels;
59235921 }
5924- };
5925-
5926- if (NamedMDNode *MD = M.getNamedMetadata (" nvvm.annotations" ))
5927- for (auto *Op : MD->operands ()) {
5928- if (Op->getNumOperands () < 2 )
5929- continue ;
5930- MDString *KindID = dyn_cast<MDString>(Op->getOperand (1 ));
5931- if (!KindID || KindID->getString () != " kernel" )
5932- continue ;
5933-
5934- if (auto *KernelFn =
5935- mdconst::dyn_extract_or_null<Function>(Op->getOperand (0 )))
5936- ProcessKernel (*KernelFn);
5937- }
5938-
5939- for (Function &F : M)
5940- if (F.hasKernelCallingConv ())
5941- ProcessKernel (F);
59425922
59435923 return Kernels;
59445924}
You can’t perform that action at this time.
0 commit comments