[PATCH] D138496: [OpenMP][OMPContext] Move SIMD alignment calculation to LLVM Frontend

Dominik Adamski via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 16 03:56:27 PST 2022


domada added inline comments.


================
Comment at: clang/include/clang/AST/ASTContext.h:460
+  /// to define the default OpenMP SIMD alignment which is target specific
+  llvm::TargetMachineCache OpenMPTargets;
+
----------------
jdoerfert wrote:
> Move it into the OpenMPIRBuilder please.
We cannot move it into the OpenMPIRBuilder because OpenMPIRBuilder is not created inside ASTContext. OpenMPIRBuilder is created inside clang LLVM IR codegen part (clang/lib/CodeGen/CGOpenMPRuntime) and I prefer not to modify this part.

That's why I initially proposed static function inside OpenMPIRBuilder. I think that we need to choose one option:  
  - Less efficient static function inside OpenMPIRBuilder which creates TargetMachine items every time (advantage: no binding to LLVM objects inside clang ASTContext)
  - TargetMachineCache object inside ASTContext and more efficient function for default alignment calculation

Personally I opt for the first option. IMO OpenMP pragma: `omp simd aligned(A)` is not very common and we can spend more time to determine the default alignment.


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

https://reviews.llvm.org/D138496



More information about the llvm-commits mailing list