[PATCH] D106687: [OpenMP] Only register HeapToShared in the OpenMPOpt module pass

Joseph Huber via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 23 10:30:17 PDT 2021


jhuber6 created this revision.
jhuber6 added a reviewer: jdoerfert.
Herald added subscribers: ormris, guansong, hiraditya, yaxunl.
jhuber6 requested review of this revision.
Herald added subscribers: llvm-commits, sstefan1.
Herald added a project: LLVM.

This patch moves registering HeapToShared to only occur in the module pass.
This does nothing if run outside of the module pass because it requires intact
call sites and all the analysis we can do has already been done.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D106687

Files:
  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
@@ -3800,6 +3800,13 @@
           /* UpdateAfterInit */ false);
       return false;
     });
+
+    auto &GlobalizationRFI = OMPInfoCache.RFIs[OMPRTL___kmpc_alloc_shared];
+    auto CreateAA = [&](Use &U, Function &F) {
+      A.getOrCreateAAFor<AAHeapToShared>(IRPosition::function(F));
+      return false;
+    };
+    GlobalizationRFI.foreachUse(SCC, CreateAA);
   }
 
   // Create CallSite AA for all Getters.
@@ -3822,12 +3829,6 @@
 
     GetterRFI.foreachUse(SCC, CreateAA);
   }
-  auto &GlobalizationRFI = OMPInfoCache.RFIs[OMPRTL___kmpc_alloc_shared];
-  auto CreateAA = [&](Use &U, Function &F) {
-    A.getOrCreateAAFor<AAHeapToShared>(IRPosition::function(F));
-    return false;
-  };
-  GlobalizationRFI.foreachUse(SCC, CreateAA);
 
   // Create an ExecutionDomain AA for every function and a HeapToStack AA for
   // every function if there is a device kernel.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D106687.361271.patch
Type: text/x-patch
Size: 1075 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210723/ae1bb0ac/attachment.bin>


More information about the llvm-commits mailing list