[flang-commits] [flang] 47aee8b - [flang][OpenMP] Set OpenMP attributes in MLIR module in bbc before lo… (#82774)

via flang-commits flang-commits at lists.llvm.org
Fri Feb 23 13:27:50 PST 2024


Author: Krzysztof Parzyszek
Date: 2024-02-23T15:27:47-06:00
New Revision: 47aee8b56d65e2bac5c7128424ff06134e454d83

URL: https://github.com/llvm/llvm-project/commit/47aee8b56d65e2bac5c7128424ff06134e454d83
DIFF: https://github.com/llvm/llvm-project/commit/47aee8b56d65e2bac5c7128424ff06134e454d83.diff

LOG: [flang][OpenMP] Set OpenMP attributes in MLIR module in bbc before lo… (#82774)

…wering

Right now attributes like OpenMP version or target attributes for
offload are set after lowering in bbc. The flang frontend sets them
before lowering, making them available in the lowering process.

This change sets them before lowering in bbc as well.

Added: 
    

Modified: 
    flang/tools/bbc/bbc.cpp

Removed: 
    


################################################################################
diff  --git a/flang/tools/bbc/bbc.cpp b/flang/tools/bbc/bbc.cpp
index e701fdeb227a40..73d740ff439421 100644
--- a/flang/tools/bbc/bbc.cpp
+++ b/flang/tools/bbc/bbc.cpp
@@ -360,7 +360,6 @@ static mlir::LogicalResult convertFortranSourceToMLIR(
       semanticsContext.targetCharacteristics(), parsing.allCooked(),
       targetTriple, kindMap, loweringOptions, envDefaults,
       semanticsContext.languageFeatures(), targetMachine);
-  burnside.lower(parseTree, semanticsContext);
   mlir::ModuleOp mlirModule = burnside.getModule();
   if (enableOpenMP) {
     if (enableOpenMPGPU && !enableOpenMPDevice) {
@@ -376,6 +375,7 @@ static mlir::LogicalResult convertFortranSourceToMLIR(
     setOffloadModuleInterfaceAttributes(mlirModule, offloadModuleOpts);
     setOpenMPVersionAttribute(mlirModule, setOpenMPVersion);
   }
+  burnside.lower(parseTree, semanticsContext);
   std::error_code ec;
   std::string outputName = outputFilename;
   if (!outputName.size())


        


More information about the flang-commits mailing list