[PATCH] D98063: [flang][fir] Add the pre-code gen rewrite pass and codegen ops.

Mehdi AMINI via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 8 18:06:32 PST 2021


mehdi_amini added inline comments.


================
Comment at: flang/lib/Optimizer/CodeGen/PreCGRewrite.cpp:234
+      runOn(global, global.getRegion());
+  }
+
----------------
mehdi_amini wrote:
> schweitz wrote:
> > mehdi_amini wrote:
> > > By making this a module pass, we're losing on parallelism.
> > > Can you make is an operation pass and filter here instead?
> > > 
> > > ```
> > > void runOnOperation()  {
> > >   Operation *op = getOperation();
> > >   if (auto func = op->dyn_cast<mlir::FuncOp>()) runOn(func, func.getBody());
> > >   if (auto global : op->dyn_cast<fir::GlobalOp>()) runOn(global, global.getRegion());
> > > }
> > > ```
> > It might be possible, but a quick experiment showed a bunch of tests regressing.
> What kind of regressions?
Actually in case I wasn't clear, the snippet I wrote above requires to schedule the pass twice in a pipeline, the test would look like this: `fir-opt --pass-pipeline="func(cg-rewrite),fir.global(cg-rewrite)"`

If you can provide an .mlir test where this regresses, I'd be happy to take a look.


================
Comment at: flang/test/Fir/cg-ops.fir:17
+  return
+}
----------------
Your test does not have any global op?


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

https://reviews.llvm.org/D98063



More information about the llvm-commits mailing list