[PATCH] D106825: Moving deglobalization to single flag

Melanie Cornelius via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 26 14:00:56 PDT 2021


mcornelius created this revision.
Herald added subscribers: ormris, okura, jdoerfert, kuter, hiraditya.
mcornelius requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added a reviewer: jdoerfert.
Herald added a reviewer: sstefan1.
Herald added subscribers: llvm-commits, bbn, sstefan1.
Herald added a reviewer: baziotis.
Herald added a project: LLVM.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D106825

Files:
  llvm/lib/Transforms/IPO/AttributorAttributes.cpp
  llvm/lib/Transforms/IPO/OpenMPOpt.cpp


Index: llvm/lib/Transforms/IPO/OpenMPOpt.cpp
===================================================================
--- llvm/lib/Transforms/IPO/OpenMPOpt.cpp
+++ llvm/lib/Transforms/IPO/OpenMPOpt.cpp
@@ -73,8 +73,8 @@
     cl::Hidden, cl::init(false));
 
 // TODO turn this into one flag
-static cl::opt<bool> DisableOpenMPOptDeglobalization1(
-    "openmp-opt-disable-deglobalization1", cl::ZeroOrMore,
+static cl::opt<bool> DisableOpenMPOptDeglobalization(
+    "openmp-opt-disable-deglobalization", cl::ZeroOrMore,
     cl::desc("Disable OpenMP optimizations involving deglobalization 1 if 2."),
     cl::Hidden, cl::init(false));
 
@@ -2620,10 +2620,6 @@
   }
 
   void initialize(Attributor &A) override {
-    // If deglobalization disabled, do not init
-    if (DisableOpenMPOptDeglobalization1)
-      indicatePessimisticFixpoint();
-
     auto &OMPInfoCache = static_cast<OMPInformationCache &>(A.getInfoCache());
     auto &RFI = OMPInfoCache.RFIs[OMPRTL___kmpc_alloc_shared];
 
@@ -3866,14 +3862,17 @@
     A.getOrCreateAAFor<AAHeapToShared>(IRPosition::function(F));
     return false;
   };
-  GlobalizationRFI.foreachUse(SCC, CreateAA);
+  // If we have disabled deglobalization, do not create HeapToShared AA
+  if (!DisableOpenMPOptDeglobalization)
+    GlobalizationRFI.foreachUse(SCC, CreateAA);
 
   // Create an ExecutionDomain AA for every function and a HeapToStack AA for
   // every function if there is a device kernel.
+  // If we have disabled deglobalization, skip making a HeapToStack AA
   for (auto *F : SCC) {
     if (!F->isDeclaration())
       A.getOrCreateAAFor<AAExecutionDomain>(IRPosition::function(*F));
-    if (isOpenMPDevice(M))
+    if (isOpenMPDevice(M) && !DisableOpenMPOptDeglobalization)
       A.getOrCreateAAFor<AAHeapToStack>(IRPosition::function(*F));
   }
 }
Index: llvm/lib/Transforms/IPO/AttributorAttributes.cpp
===================================================================
--- llvm/lib/Transforms/IPO/AttributorAttributes.cpp
+++ llvm/lib/Transforms/IPO/AttributorAttributes.cpp
@@ -64,12 +64,6 @@
     cl::location(llvm::PotentialConstantIntValuesState::MaxPotentialValues),
     cl::init(7));
 
-// TODO turn this into one flag not two
-static cl::opt<bool> DisableOpenMPOptDeglobalization2(
-    "openmp-opt-disable-deglobalization2", cl::ZeroOrMore,
-    cl::desc("Disable OpenMP optimizations involving deglobalization 2 of 2."),
-    cl::Hidden, cl::init(false));
-
 STATISTIC(NumAAs, "Number of abstract attributes created");
 
 // Some helper macros to deal with statistics tracking.
@@ -5650,11 +5644,6 @@
   }
 
   void initialize(Attributor &A) override {
-    // If we have disabled deglobalization, stop
-    // TODO need to make these into one flag
-    if (DisableOpenMPOptDeglobalization2)
-      indicatePessimisticFixpoint();
-
     AAHeapToStack::initialize(A);
 
     const Function *F = getAnchorScope();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D106825.361791.patch
Type: text/x-patch
Size: 2886 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210726/56d7e878/attachment.bin>


More information about the llvm-commits mailing list