[PATCH] D71267: [OpenMPIRBuilder] Add support for generating kmpc_for_static_fini

Kiran Chandramohan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 1 00:46:52 PDT 2020


kiranchandramohan added inline comments.


================
Comment at: clang/lib/CodeGen/CGOpenMPRuntime.cpp:2819
+  }
 }
 
----------------
jdoerfert wrote:
> We do emit exactly the same code in both cases, don't we?
> If so, use the always available OMPIRBuilder unconditionally.
As of now there is a minor difference. The IRBuilder static fini generates a new call to kmpc_global_thread_num, the existing flow reuses the value computed by a previous call to kmpc_global_thread_num. Seems to be the same functionality.
```
<   call void @__kmpc_for_static_fini(%struct.ident_t* @1, i32 %8)
---
>   %31 = call i32 @__kmpc_global_thread_num(%struct.ident_t* @2)
>   call void @__kmpc_for_static_fini(%struct.ident_t* @1, i32 %31)
```


================
Comment at: llvm/include/llvm/Frontend/OpenMP/OMPConstants.h:92
+bool isOpenMPLoopDirective(Directive DKind);
+
 } // end namespace omp
----------------
jdoerfert wrote:
> Where is the definition for these?
Good catch. These are in the OMPConstants.cpp file. But i guess we do not want that file.

So we can generate these from the tablegen and remove their declaration here and in OMPConstants.cpp. Is that the right approach?


================
Comment at: llvm/lib/Frontend/OpenMP/CMakeLists.txt:7
   OMP.cpp # Generated by tablegen above
+  OMPConstants.cpp
   OMPContext.cpp
----------------
jdoerfert wrote:
> Do we still have that file?
I will remove this. Also see comment above.


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

https://reviews.llvm.org/D71267



More information about the llvm-commits mailing list