[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 01:19:43 PDT 2022


rovka updated this revision to Diff 420406.
rovka added a comment.

Added a flag to tco to disable the pass, and used it in the test (which means we no longer need to modify it).
I'm still trying to figure out if I can get tco and flang-new to dump the pass pipeline that they're running, so we can check that the pass is indeed added.


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

https://reviews.llvm.org/D121171

Files:
  flang/include/flang/Tools/CLOptions.inc
  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/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.420406.patch
Type: text/x-patch
Size: 1534 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20220405/b9933c3d/attachment.bin>


More information about the flang-commits mailing list