[Openmp-commits] [PATCH] D122550: [NVPTX] Allow degenerated `nvvm.annotations`

Daniil Kovalev via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Sun Mar 27 18:53:08 PDT 2022


kovdan01 requested changes to this revision.
kovdan01 added inline comments.
This revision now requires changes to proceed.


================
Comment at: llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp:4268-4296
 #ifndef NDEBUG
     const NamedMDNode *NMDN =
         F->getParent()->getNamedMetadata("nvvm.annotations");
     if (NMDN) {
       for (const MDNode *MDN : NMDN->operands()) {
         assert(MDN->getNumOperands() == 3);
 
----------------
During investigation, discovered a nice function `bool isKernelFunction(const Function &);` in NVPTXUtilities. It does the same thing (with going inside metadata) but correctly in its implementation. So I suppose that we can replace the whole ifndef block with a single asserion:

```
assert(!isKernelFunction(*F));
```

Also, if we use an already existing function instead of reinventing a wheel, looks like there is no need in altering tests.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D122550/new/

https://reviews.llvm.org/D122550



More information about the Openmp-commits mailing list