[PATCH] D151445: [Flang] Add main-file-name flag to flang -fc1

Dominik Adamski via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 25 13:22:42 PDT 2023


domada added a comment.

In D151445#4372892 <https://reviews.llvm.org/D151445#4372892>, @clementval wrote:

> You should be able to get this information from the source location in MLIR.

Hi, thank you for your quick feedback.

You are right, the source location is provided in MLIR. Unfortunately, when we compile the source code with -save-temps file, then we use preprocessed file as the input for MLIR and we have no information about original source file.

Please look at the output of the command:
`flang-new -save-temps -v **test.f90**`

Output:
`flang-new -fc1 /*some fc1 options */ **-o test.i test.f90**`
`flang-new -fc1 /*some fc1 options */ **-o test.bc test.i**`

If we generate the code for OpenMP, then we generate two different preprocessed files (one for host code, the second one for the device). Then we use these preprocessed files as the input for MLIR. Originally we use the name of preprocessed file as the input for generation of unique name of OpenMP kernel function (please look at the original code inside mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp  ). In consequence we generate two different kernel names for host and the device module (host and the device code should operate on the same name of the kernel function). To fix that isssue I provide an information about the original source file (not the name of the input preprocessed file).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151445



More information about the cfe-commits mailing list