[llvm] 6632180 - [OpenMP][NFC] Add an option to print the module before in OpenMPOpt
Joseph Huber via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 1 14:09:18 PST 2022
Author: Joseph Huber
Date: 2022-03-01T17:09:09-05:00
New Revision: 6632180745a2679cfd4631a607759ccc519e5da5
URL: https://github.com/llvm/llvm-project/commit/6632180745a2679cfd4631a607759ccc519e5da5
DIFF: https://github.com/llvm/llvm-project/commit/6632180745a2679cfd4631a607759ccc519e5da5.diff
LOG: [OpenMP][NFC] Add an option to print the module before in OpenMPOpt
Previously there was a debug flag to print the module after
optimizations. Sometimes we wanted to print the module before
optimizations so this is being split into two flags.
`-openmp-opt-print-module` is now `-openmp-opt-print-module-after`.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D120768
Added:
Modified:
llvm/lib/Transforms/IPO/OpenMPOpt.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/IPO/OpenMPOpt.cpp b/llvm/lib/Transforms/IPO/OpenMPOpt.cpp
index 57a854f2e239e..7b70082a15cd5 100644
--- a/llvm/lib/Transforms/IPO/OpenMPOpt.cpp
+++ b/llvm/lib/Transforms/IPO/OpenMPOpt.cpp
@@ -110,10 +110,15 @@ static cl::opt<bool> DisableOpenMPOptBarrierElimination(
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 @@ PreservedAnalyses OpenMPOptPass::run(Module &M, ModuleAnalysisManager &AM) {
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 @@ PreservedAnalyses OpenMPOptCGSCCPass::run(LazyCallGraph::SCC &C,
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 =
More information about the llvm-commits
mailing list