[Openmp-commits] [openmp] 80fa43f - Revert "[openmp] Add addrspacecast to getOrCreateIdent"

Jon Chesterfield via Openmp-commits openmp-commits at lists.llvm.org
Mon Sep 27 11:27:44 PDT 2021


Author: Jon Chesterfield
Date: 2021-09-27T19:27:35+01:00
New Revision: 80fa43fe9ab41e4e035547ab0f1955efa81de3a2

URL: https://github.com/llvm/llvm-project/commit/80fa43fe9ab41e4e035547ab0f1955efa81de3a2
DIFF: https://github.com/llvm/llvm-project/commit/80fa43fe9ab41e4e035547ab0f1955efa81de3a2.diff

LOG: Revert "[openmp] Add addrspacecast to getOrCreateIdent"

This reverts commit 1a761e5b7b50dc08e0ff7f7aea65e1da29c5cd80.
Failed CI, albeit with a different failure mode to BZ51982

Added: 
    

Modified: 
    llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp

Removed: 
    openmp/libomptarget/test/offloading/bug51982.c


################################################################################
diff  --git a/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp b/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
index 36f6fa68ce242..94217c632e436 100644
--- a/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
+++ b/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
@@ -276,20 +276,15 @@ Value *OpenMPIRBuilder::getOrCreateIdent(Constant *SrcLocStr,
     for (GlobalVariable &GV : M.getGlobalList())
       if (GV.getValueType() == OpenMPIRBuilder::Ident && GV.hasInitializer())
         if (GV.getInitializer() == Initializer)
-          Ident = &GV;
-
-    if (!Ident) {
-      auto *GV = new GlobalVariable(
-          M, OpenMPIRBuilder::Ident,
-          /* isConstant = */ true, GlobalValue::PrivateLinkage, Initializer, "",
-          nullptr, GlobalValue::NotThreadLocal,
-          M.getDataLayout().getDefaultGlobalsAddressSpace());
-      GV->setUnnamedAddr(GlobalValue::UnnamedAddr::Global);
-      GV->setAlignment(Align(8));
-      Ident = GV;
-    }
+          return Ident = &GV;
+
+    auto *GV = new GlobalVariable(M, OpenMPIRBuilder::Ident,
+                                  /* isConstant = */ true,
+                                  GlobalValue::PrivateLinkage, Initializer);
+    GV->setUnnamedAddr(GlobalValue::UnnamedAddr::Global);
+    GV->setAlignment(Align(8));
+    Ident = GV;
   }
-
   return Builder.CreatePointerCast(Ident, IdentPtr);
 }
 

diff  --git a/openmp/libomptarget/test/offloading/bug51982.c b/openmp/libomptarget/test/offloading/bug51982.c
deleted file mode 100644
index 4211190ec2ddf..0000000000000
--- a/openmp/libomptarget/test/offloading/bug51982.c
+++ /dev/null
@@ -1,24 +0,0 @@
-// RUN: %libomptarget-compile-generic -O1 && %libomptarget-run-generic
-// -O1 to run openmp-opt
-
-int main(void) {
-  long int aa = 0;
-
-  int ng = 12;
-  int nxyz = 5;
-
-  const long exp = ng * nxyz;
-
-#pragma omp target map(tofrom : aa)
-  for (int gid = 0; gid < nxyz; gid++) {
-#pragma omp parallel for
-    for (unsigned int g = 0; g < ng; g++) {
-#pragma omp atomic
-      aa += 1;
-    }
-  }
-  if (aa != exp) {
-    return 1;
-  }
-  return 0;
-}


        


More information about the Openmp-commits mailing list