[PATCH] D120768: [OpenMP][NFC] Add an option to print the module before in OpenMPOpt

Joseph Huber via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 1 14:09:20 PST 2022


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG6632180745a2: [OpenMP][NFC] Add an option to print the module before in OpenMPOpt (authored by jhuber6).

Changed prior to commit:
  https://reviews.llvm.org/D120768?vs=412231&id=412249#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D120768

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
@@ -110,10 +110,15 @@
     cl::Hidden, cl::init(false));
 
 static cl::opt<bool> PrintModuleAfterOptimizations(
-    "openmp-opt-print-module", cl::ZeroOrMore,
+    "openmp-opt-print-module-after", cl::ZeroOrMore,
     cl::desc("Print the current module after OpenMP optimizations."),
     cl::Hidden, cl::init(false));
 
+static cl::opt<bool> PrintModuleBeforeOptimizations(
+    "openmp-opt-print-module-before", cl::ZeroOrMore,
+    cl::desc("Print the current module before OpenMP optimizations."),
+    cl::Hidden, cl::init(false));
+
 static cl::opt<bool> AlwaysInlineDeviceFunctions(
     "openmp-opt-inline-device", cl::ZeroOrMore,
     cl::desc("Inline all applicible functions on the device."), cl::Hidden,
@@ -4916,6 +4921,9 @@
       AM.getResult<FunctionAnalysisManagerModuleProxy>(M).getManager();
   KernelSet Kernels = getDeviceKernels(M);
 
+  if (PrintModuleBeforeOptimizations)
+    LLVM_DEBUG(dbgs() << TAG << "Module before OpenMPOpt Module Pass:\n" << M);
+
   auto IsCalled = [&](Function &F) {
     if (Kernels.contains(&F))
       return true;
@@ -5018,6 +5026,9 @@
 
   Module &M = *C.begin()->getFunction().getParent();
 
+  if (PrintModuleBeforeOptimizations)
+    LLVM_DEBUG(dbgs() << TAG << "Module before OpenMPOpt CGSCC Pass:\n" << M);
+
   KernelSet Kernels = getDeviceKernels(M);
 
   FunctionAnalysisManager &FAM =


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D120768.412249.patch
Type: text/x-patch
Size: 1547 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220301/73bf2aeb/attachment.bin>


More information about the llvm-commits mailing list