[PATCH] D110556: [openmp] Add addrspacecast to getOrCreateIdent

Jon Chesterfield via Phabricator via llvm-commits llvm-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


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110556



More information about the llvm-commits mailing list