diff --git a/flang/include/flang/Optimizer/CodeGen/CGPasses.td b/flang/include/flang/Optimizer/CodeGen/CGPasses.td --- a/flang/include/flang/Optimizer/CodeGen/CGPasses.td +++ b/flang/include/flang/Optimizer/CodeGen/CGPasses.td @@ -23,10 +23,7 @@ will also convert ops in the standard and FIRCG dialects. }]; let constructor = "::fir::createFIRToLLVMPass()"; - let dependentDialects = [ - "fir::FIROpsDialect", "fir::FIRCodeGenDialect", "mlir::BuiltinDialect", - "mlir::LLVM::LLVMDialect", "mlir::omp::OpenMPDialect" - ]; + let dependentDialects = ["mlir::LLVM::LLVMDialect"]; } def CodeGenRewrite : Pass<"cg-rewrite"> { diff --git a/flang/lib/Optimizer/CodeGen/CodeGen.cpp b/flang/lib/Optimizer/CodeGen/CodeGen.cpp --- a/flang/lib/Optimizer/CodeGen/CodeGen.cpp +++ b/flang/lib/Optimizer/CodeGen/CodeGen.cpp @@ -44,9 +44,8 @@ return *static_cast(this->getTypeConverter()); } }; -} // namespace -namespace { +// Lower `fir.address_of` operation to `llvm.address_of` operation. struct AddrOfOpConversion : public FIROpConversion { using FIROpConversion::FIROpConversion; @@ -60,6 +59,7 @@ } }; +/// Lower `fir.has_value` operation to `llvm.return` operation. struct HasValueOpConversion : public FIROpConversion { using FIROpConversion::FIROpConversion; @@ -71,6 +71,9 @@ } }; +/// Lower `fir.global` operation to `llvm.global` operation. +/// `fir.insert_on_range` operations are replaced with constant dense attribute +/// if they are applied on the full range. struct GlobalOpConversion : public FIROpConversion { using FIROpConversion::FIROpConversion; @@ -133,6 +136,8 @@ return true; } + // TODO: String comparaison should be avoided. Replace linkName with an + // enumeration. mlir::LLVM::Linkage convertLinkage(Optional optLinkage) const { if (optLinkage.hasValue()) { auto name = optLinkage.getValue();