[Openmp-commits] [PATCH] D110556: [openmp] Add addrspacecast to getOrCreateIdent

Jon Chesterfield via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Mon Sep 27 10:41:29 PDT 2021

JonChesterfield added inline comments.

Comment at: llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp:282
+    if (!Ident) {
+      auto *GV = new GlobalVariable(M, OpenMPIRBuilder::Ident,
+                                    /* isConstant = */ true,
Replacing this constructor call with one that specifies the address space does not solve this bug. It probably makes it more widespread as now all Ident variables would be in AS1 as opposed to only some of them. 

Likewise, only casting the newly created GlobalVariable to addrspace(0) does not help, as the one that was returned by `return Ident = &GV; `

The patch here that ensures the result of getOrCreateIdent is in same address space as IdentPtr (i.e. none) looks necessary regardless of whether the global variable is created in AS1 or ASnone.

I tested this by hardcoding 1

  rG LLVM Github Monorepo



More information about the Openmp-commits mailing list