[flang-commits] [PATCH] D121171: [flang] Add ExternalNameConversionPass to flang-new pipeline
Diana Picus via Phabricator via flang-commits
flang-commits at lists.llvm.org
Tue Apr 5 05:37:52 PDT 2022
rovka updated this revision to Diff 420466.
rovka added a comment.
Added a test for tco's default pass pipeline. This is hijacking the MLIR pass manager's capabilities for printing statistics, because I couldn't find something more direct. Would be nice to add something like this for flang-new as well. @awarzynski does flang-new have something that can forward options to MLIR? (I'm thinking of something like -mllvm)
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D121171/new/
https://reviews.llvm.org/D121171
Files:
flang/include/flang/Tools/CLOptions.inc
flang/test/Fir/basic-program.fir
flang/test/Lower/common-block.f90
Index: flang/test/Lower/common-block.f90
===================================================================
--- flang/test/Lower/common-block.f90
+++ flang/test/Lower/common-block.f90
@@ -1,4 +1,4 @@
-! RUN: bbc %s -o - | tco | FileCheck %s
+! RUN: bbc %s -o - | tco -disable-external-name-interop | FileCheck %s
! CHECK: @_QB = common global [8 x i8] zeroinitializer
! CHECK: @_QBx = global { float, float } { float 1.0{{.*}}, float 2.0{{.*}} }
Index: flang/test/Fir/basic-program.fir
===================================================================
--- flang/test/Fir/basic-program.fir
+++ flang/test/Fir/basic-program.fir
@@ -1,6 +1,8 @@
// RUN: tco %s | FileCheck %s
+// RUN: tco %s --pass-statistics --pass-statistics-display=pipeline 2>&1 | FileCheck %s --check-prefix=PASSES
// Check that tco is working with a basic test.
+// Also check the passes in the default pipeline.
func @_QQmain() {
return
@@ -9,3 +11,31 @@
// CHECK: ; ModuleID = 'FIRModule'
// CHECK-LABEL: define void @_QQmain()
// CHECK: ret void
+
+// PASSES: Pass statistics report
+
+// PASSES-LABEL: 'func.func' Pipeline
+// PASSES: ArrayValueCopy
+// PASSES: CharacterConversion
+// PASSES: Canonicalizer
+// PASSES: SimplifyRegionLite
+
+// PASSES-LABEL: 'func.func' Pipeline
+// PASSES: MemoryAllocationOpt
+// PASSES: Inliner
+// PASSES: CSE
+
+// PASSES-LABEL: 'func.func' Pipeline
+// PASSES: CFGConversion
+// PASSES: SCFToControlFlow
+// PASSES: Canonicalizer
+// PASSES: SimplifyRegionLite
+// PASSES: BoxedProcedurePass
+
+// PASSES-LABEL: 'func.func' Pipeline
+// PASSES: AbstractResultOpt
+// PASSES: CodeGenRewrite
+// PASSES: TargetRewrite
+// PASSES: ExternalNameConversion
+// PASSES: FIRToLLVMLowering
+// PASSES: (anonymous namespace)::LLVMIRLoweringPass
Index: flang/include/flang/Tools/CLOptions.inc
===================================================================
--- flang/include/flang/Tools/CLOptions.inc
+++ flang/include/flang/Tools/CLOptions.inc
@@ -66,6 +66,8 @@
"rewrite boxed procedures");
#endif
+DisableOption(ExternalNameConversion, "external-name-interop", "convert names with external convention");
+
/// Generic for adding a pass to the pass manager if it is not disabled.
template <typename F>
void addPassConditionally(
@@ -139,6 +141,11 @@
}
#endif
+inline void addExternalNameConversionPass(mlir::PassManager &pm) {
+ addPassConditionally(pm, disableExternalNameConversion,
+ [&]() { return fir::createExternalNameConversionPass(); });
+}
+
/// Create a pass pipeline for running default optimization passes for
/// incremental conversion of FIR.
///
@@ -174,6 +181,7 @@
pm.addNestedPass<mlir::FuncOp>(fir::createAbstractResultOptPass());
fir::addCodeGenRewritePass(pm);
fir::addTargetRewritePass(pm);
+ fir::addExternalNameConversionPass(pm);
fir::addFIRToLLVMPass(pm);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D121171.420466.patch
Type: text/x-patch
Size: 2857 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20220405/d21b11ab/attachment-0001.bin>
More information about the flang-commits
mailing list