[PATCH] D155794: [OpenMP][OpenMPIRBuilder] Migrate setPropertyExecutionMode() from Clang to OpenMPIRBuilder.

Jan-Patrick Lehr via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 26 04:42:21 PDT 2023


jplehr added inline comments.


================
Comment at: llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp:4914
+  GVMode->setVisibility(llvm::GlobalVariable::ProtectedVisibility);
+  assert(!GVMode->isDeclaration() &&
+         "Only globals with definition can force usage.");
----------------
raghavendhra wrote:
> jplehr wrote:
> > Can this assertion ever be not be met? I'm just curious, given that you create that `GVMode` yourself.
> Adopted this assert from Clang Codegen addCompilerUsedGlobal() which is called inside setPropertyExecutionMode() in CGOpenMPRuntimeGPU.cpp
> 
> Actual definition of addCompilerusedGlobal() in CodeGenModule.cpp
> 
> void CodeGenModule::addCompilerUsedGlobal(llvm::GlobalValue *GV) {
>   assert(!GV->isDeclaration() &&
>          "Only globals with definition can force usage.");
>   LLVMCompilerUsed.emplace_back(GV);
> }
Sorry for the confusion I potentially created: I mainly wanted to understand if that case can ever happen.
I'm not really familiar with this part of the compiler.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D155794



More information about the cfe-commits mailing list