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) {
5906
5906
}
5907
5907
5908
5908
KernelSet llvm::omp::getDeviceKernels (Module &M) {
5909
- // TODO: Create a more cross-platform way of determining device kernels.
5910
5909
KernelSet Kernels;
5911
5910
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 ()) {
5915
5913
// We are only interested in OpenMP target regions. Others, such as
5916
5914
// kernels generated by CUDA but linked together, are not interesting to
5917
5915
// this pass.
5918
- if (isOpenMPKernel (KF )) {
5916
+ if (isOpenMPKernel (F )) {
5919
5917
++NumOpenMPTargetRegionKernels;
5920
- Kernels.insert (&KF );
5918
+ Kernels.insert (&F );
5921
5919
} else
5922
5920
++NumNonOpenMPTargetRegionKernels;
5923
5921
}
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);
5942
5922
5943
5923
return Kernels;
5944
5924
}
You can’t perform that action at this time.
0 commit comments