Skip to content

Commit 63e4cfa

Browse files
authored
[fir] Sync back after D112845
1 parent a81f808 commit 63e4cfa

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

flang/include/flang/Optimizer/CodeGen/CGPasses.td

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,7 @@ def FIRToLLVMLowering : Pass<"fir-to-llvm-ir", "mlir::ModuleOp"> {
2323
will also convert ops in the standard and FIRCG dialects.
2424
}];
2525
let constructor = "::fir::createFIRToLLVMPass()";
26-
let dependentDialects = [
27-
"fir::FIROpsDialect", "fir::FIRCodeGenDialect", "mlir::BuiltinDialect",
28-
"mlir::LLVM::LLVMDialect", "mlir::omp::OpenMPDialect"
29-
];
26+
let dependentDialects = ["mlir::LLVM::LLVMDialect"];
3027
}
3128

3229
def CodeGenRewrite : Pass<"cg-rewrite", "mlir::ModuleOp"> {

flang/lib/Optimizer/CodeGen/CodeGen.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,7 @@ static void createGlobal(mlir::Location loc, mlir::ModuleOp mod, StringRef name,
309309
}
310310

311311
namespace {
312+
/// Lower `fir.address_of` operation to `llvm.address_of` operation.
312313
struct AddrOfOpConversion : public FIROpConversion<fir::AddrOfOp> {
313314
using FIROpConversion::FIROpConversion;
314315

@@ -2447,6 +2448,7 @@ struct GlobalLenOpConversion : public FIROpConversion<fir::GlobalLenOp> {
24472448
}
24482449
};
24492450

2451+
/// Lower `fir.has_value` operation to `llvm.return` operation.
24502452
struct HasValueOpConversion : public FIROpConversion<fir::HasValueOp> {
24512453
using FIROpConversion::FIROpConversion;
24522454

@@ -2458,6 +2460,9 @@ struct HasValueOpConversion : public FIROpConversion<fir::HasValueOp> {
24582460
}
24592461
};
24602462

2463+
/// Lower `fir.global` operation to `llvm.global` operation.
2464+
/// `fir.insert_on_range` operations are replaced with constant dense attribute
2465+
/// if they are applied on the full range.
24612466
struct GlobalOpConversion : public FIROpConversion<fir::GlobalOp> {
24622467
using FIROpConversion::FIROpConversion;
24632468

@@ -2520,6 +2525,8 @@ struct GlobalOpConversion : public FIROpConversion<fir::GlobalOp> {
25202525
return true;
25212526
}
25222527

2528+
// TODO: String comparison should be avoided. Replace linkName with an
2529+
// enumeration.
25232530
mlir::LLVM::Linkage convertLinkage(Optional<StringRef> optLinkage) const {
25242531
if (optLinkage.hasValue()) {
25252532
auto name = optLinkage.getValue();

0 commit comments

Comments
 (0)