[PATCH] D117781: [flang] Update tco tool pipline and add translation to LLVM IR

Valentin Clement via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 20 09:40:00 PST 2022


clementval added a comment.

In D117781#3258461 <https://reviews.llvm.org/D117781#3258461>, @mehdi_amini wrote:

> What's the difference between tco and fir-opt? Just that the former can emit LLVM IR instead of LLVM dialect? And that the no-argument invocation will run the lowering pipeline?
> For running pipeline, why not involve the `flang` binary? (this is what clang is doing by the way: it can take LLVM IR as input as well and emit LLVM IR, run various optimization pipeline, assembly, object, and handles the usual options you need anyway through frontend options. Between what you'd want to expose through `flang` anyway and what you already have with fir-opt, it's not clear to me the fundamental role tco plays? (I think I remember that it just existed before fir-opt and before there was a flang driver).

`fir-opt` doesn't have any defined pipeline and is similar to `mlir-opt`. We use it to test FIR to FIR passes. `tco` is meant to test the second half of the pipeline from FIR to LLVMIR. It has the same defined pipeline that the final Flang binary will have. At the moment we do not have a proper flang driver upstream but it will come in the last steps of the upstreaming from fir-dev. The pipeline is currently shared in fir-dev so we are sure we test the same things (defined in CLOptions.inc). Once we have a proper flang driver that have similar capabilities than clang we might change the test to make use of it and maybe retire `tco`.



================
Comment at: flang/tools/tco/tco.cpp:109
+  } else if (passPipeline.hasAnyOccurrences()) {
+    // FIXME: handle result
+    (void)passPipeline.addToPipeline(pm, [&](const Twine &msg) {
----------------
mehdi_amini wrote:
> Why deferring this? Can't you propagate the failure?
Sure. I spotted that after I pushed the patch and I'll change it. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D117781



More information about the llvm-commits mailing list