[PATCH] D146075: [flang][driver][openmp] Write MLIR for -save-temps

Andrzej Warzynski via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 24 09:08:42 PDT 2023


awarzynski accepted this revision.
awarzynski added a comment.

LGTM!



================
Comment at: flang/test/Driver/save-temps.f90:14
 ! CHECK-NEXT: "-o" "save-temps.o"
 ! CHECK-NEXT: "-o" "a.out"
 
----------------
skatrak wrote:
> awarzynski wrote:
> > skatrak wrote:
> > > awarzynski wrote:
> > > > Why are there no MLIR files here? Same comment for other invocations.
> > > This is because the general way in which -save-temps works is different from what's implemented in this patch for MLIR in flang. In the other cases, the driver splits the work into several frontend invocations, where each step generally produces the input of the next. `-save-temps` makes sure these intermediate files are kept where the user specified and not deleted.
> > > 
> > > In this patch, instead of modifying the driver to create a frontend invocation to produce MLIR (generating the *-fir.mlir file), another one to optimize/lower that (generating the *-llvmir.mlir file), and a third one to translate lowered MLIR into LLVM IR, we just forward the flag to the frontend, which creates extra MLIR files at particular spots of the codegen process if the flag is set. Hence, MLIR files don't show in the output of `flang-new -###`.
> > So, IIUC, without `-emit-llvm-bc` there should be no intermediate MLIR files? I would add `CHECK-NOT`.
> Actually, with this approach there are no changes to the output of `flang -###` either way. I was using `-fc1 -emit-llvm-bc` just because that triggers both MLIR temp outputs (the one before any optimizations/lowering, and the one right before LLVM IR generation), but I simplified that a bit by just using `flang -c` instead and avoid confusion.
Ah, I missed that, good point!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D146075



More information about the cfe-commits mailing list