Skip to content

Commit

Permalink
remove dead omp code
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexMaclean committed Jan 29, 2025
1 parent ffbfd68 commit 7f126e1
Showing 1 changed file with 4 additions and 24 deletions.
28 changes: 4 additions & 24 deletions llvm/lib/Transforms/IPO/OpenMPOpt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5906,39 +5906,19 @@ bool llvm::omp::isOpenMPKernel(Function &Fn) {
}

KernelSet llvm::omp::getDeviceKernels(Module &M) {
// TODO: Create a more cross-platform way of determining device kernels.
KernelSet Kernels;

DenseSet<const Function *> SeenKernels;
auto ProcessKernel = [&](Function &KF) {
if (SeenKernels.insert(&KF).second) {
for (Function &F : M)
if (F.hasKernelCallingConv()) {
// 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(KF)) {
if (isOpenMPKernel(F)) {
++NumOpenMPTargetRegionKernels;
Kernels.insert(&KF);
Kernels.insert(&F);
} else
++NumNonOpenMPTargetRegionKernels;
}
};

if (NamedMDNode *MD = M.getNamedMetadata("nvvm.annotations"))
for (auto *Op : MD->operands()) {
if (Op->getNumOperands() < 2)
continue;
MDString *KindID = dyn_cast<MDString>(Op->getOperand(1));
if (!KindID || KindID->getString() != "kernel")
continue;

if (auto *KernelFn =
mdconst::dyn_extract_or_null<Function>(Op->getOperand(0)))
ProcessKernel(*KernelFn);
}

for (Function &F : M)
if (F.hasKernelCallingConv())
ProcessKernel(F);

return Kernels;
}
Expand Down

0 comments on commit 7f126e1

Please sign in to comment.