[flang-commits] [flang] 27bc8a1 - [flang][NFC] Split CG dialect and the passes. (#135240)

via flang-commits flang-commits at lists.llvm.org
Thu Apr 10 16:13:08 PDT 2025


Author: Slava Zakharin
Date: 2025-04-10T16:13:04-07:00
New Revision: 27bc8a1811d417c2d38646a3473226431987e7d9

URL: https://github.com/llvm/llvm-project/commit/27bc8a1811d417c2d38646a3473226431987e7d9
DIFF: https://github.com/llvm/llvm-project/commit/27bc8a1811d417c2d38646a3473226431987e7d9.diff

LOG: [flang][NFC] Split CG dialect and the passes. (#135240)

I am making a CG pass to depend on `FIROpenACCSupport` in #134346.
This introduces a cyclic dependency between `FIROpenACCSupport`
and `FIRCodeGen`. This patch splits `FIRCodeGen` into
`FIRCodeGenDialect` (for FIR CG dialect definition) and `FIRCodeGen`
(for the CG passes).

Now, `FIROpenACCSupport` depends on `FIRCodeGenDialect`,
and `FIRCodeGen` depends on `FIROpenACCSupport`.

Added: 
    flang/include/flang/Optimizer/Dialect/FIRCG/CGOps.h
    flang/include/flang/Optimizer/Dialect/FIRCG/CGOps.td
    flang/include/flang/Optimizer/Dialect/FIRCG/CMakeLists.txt
    flang/lib/Optimizer/Dialect/FIRCG/CGOps.cpp
    flang/lib/Optimizer/Dialect/FIRCG/CMakeLists.txt

Modified: 
    flang/include/flang/Optimizer/CodeGen/CMakeLists.txt
    flang/include/flang/Optimizer/Dialect/CMakeLists.txt
    flang/lib/Frontend/CMakeLists.txt
    flang/lib/Optimizer/CodeGen/CMakeLists.txt
    flang/lib/Optimizer/CodeGen/CodeGen.cpp
    flang/lib/Optimizer/CodeGen/PreCGRewrite.cpp
    flang/lib/Optimizer/Dialect/CMakeLists.txt
    flang/lib/Optimizer/OpenACC/CMakeLists.txt
    flang/lib/Optimizer/OpenACC/FIROpenACCTypeInterfaces.cpp
    flang/lib/Optimizer/Transforms/AddDebugInfo.cpp
    flang/lib/Optimizer/Transforms/CMakeLists.txt
    flang/lib/Optimizer/Transforms/DebugTypeGenerator.h
    flang/tools/fir-opt/CMakeLists.txt
    flang/tools/tco/CMakeLists.txt
    flang/unittests/Optimizer/CMakeLists.txt

Removed: 
    flang/include/flang/Optimizer/CodeGen/CGOps.h
    flang/include/flang/Optimizer/CodeGen/CGOps.td
    flang/lib/Optimizer/CodeGen/CGOps.cpp


################################################################################
diff  --git a/flang/include/flang/Optimizer/CodeGen/CMakeLists.txt b/flang/include/flang/Optimizer/CodeGen/CMakeLists.txt
index 3eda75190ba20..f83bf5e092ca0 100644
--- a/flang/include/flang/Optimizer/CodeGen/CMakeLists.txt
+++ b/flang/include/flang/Optimizer/CodeGen/CMakeLists.txt
@@ -1,8 +1,3 @@
-set(LLVM_TARGET_DEFINITIONS CGOps.td)
-mlir_tablegen(CGOps.h.inc -gen-op-decls)
-mlir_tablegen(CGOps.cpp.inc -gen-op-defs)
-add_public_tablegen_target(CGOpsIncGen)
-
 set(LLVM_TARGET_DEFINITIONS CGPasses.td)
 mlir_tablegen(CGPasses.h.inc -gen-pass-decls -name OptCodeGen)
 add_public_tablegen_target(FIROptCodeGenPassIncGen)

diff  --git a/flang/include/flang/Optimizer/Dialect/CMakeLists.txt b/flang/include/flang/Optimizer/Dialect/CMakeLists.txt
index 73f388cbab6c9..4c02856cd5fda 100644
--- a/flang/include/flang/Optimizer/Dialect/CMakeLists.txt
+++ b/flang/include/flang/Optimizer/Dialect/CMakeLists.txt
@@ -1,4 +1,5 @@
 add_subdirectory(CUF)
+add_subdirectory(FIRCG)
 
 # This replicates part of the add_mlir_dialect cmake function from MLIR that
 # cannot be used her because it expects to be run inside MLIR directory which

diff  --git a/flang/include/flang/Optimizer/CodeGen/CGOps.h b/flang/include/flang/Optimizer/Dialect/FIRCG/CGOps.h
similarity index 79%
rename from flang/include/flang/Optimizer/CodeGen/CGOps.h
rename to flang/include/flang/Optimizer/Dialect/FIRCG/CGOps.h
index df909d9ee81cb..9dc11d6654f23 100644
--- a/flang/include/flang/Optimizer/CodeGen/CGOps.h
+++ b/flang/include/flang/Optimizer/Dialect/FIRCG/CGOps.h
@@ -10,14 +10,14 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef OPTIMIZER_CODEGEN_CGOPS_H
-#define OPTIMIZER_CODEGEN_CGOPS_H
+#ifndef OPTIMIZER_DIALECT_FIRCG_CGOPS_H
+#define OPTIMIZER_DIALECT_FIRCG_CGOPS_H
 
 #include "flang/Optimizer/Dialect/FIRAttr.h"
 #include "flang/Optimizer/Dialect/FIRType.h"
 #include "mlir/Dialect/Func/IR/FuncOps.h"
 
 #define GET_OP_CLASSES
-#include "flang/Optimizer/CodeGen/CGOps.h.inc"
+#include "flang/Optimizer/Dialect/FIRCG/CGOps.h.inc"
 
-#endif
+#endif // OPTIMIZER_DIALECT_FIRCG_CGOPS_H

diff  --git a/flang/include/flang/Optimizer/CodeGen/CGOps.td b/flang/include/flang/Optimizer/Dialect/FIRCG/CGOps.td
similarity index 85%
rename from flang/include/flang/Optimizer/CodeGen/CGOps.td
rename to flang/include/flang/Optimizer/Dialect/FIRCG/CGOps.td
index f65291fc64c17..d48caf1a8cb3b 100644
--- a/flang/include/flang/Optimizer/CodeGen/CGOps.td
+++ b/flang/include/flang/Optimizer/Dialect/FIRCG/CGOps.td
@@ -1,4 +1,4 @@
-//===-- CGOps.td - FIR operation definitions ---------------*- tablegen -*-===//
+//===-- CGOps.td - FIR CodeGen operation definitions -------*- tablegen -*-===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
@@ -28,7 +28,7 @@ def fircg_Dialect : Dialect {
 // Base class for FIR CG operations.
 // All operations automatically get a prefix of "fircg.".
 class fircg_Op<string mnemonic, list<Trait> traits>
-  : Op<fircg_Dialect, mnemonic, traits>;
+    : Op<fircg_Dialect, mnemonic, traits>;
 
 // Extended embox operation.
 def fircg_XEmboxOp : fircg_Op<"ext_embox", [AttrSizedOperandSegments]> {
@@ -55,17 +55,12 @@ def fircg_XEmboxOp : fircg_Op<"ext_embox", [AttrSizedOperandSegments]> {
     The memref and shape arguments are mandatory. The rest are optional.
   }];
 
-  let arguments = (ins
-    AnyReferenceLike:$memref,
-    Variadic<AnyIntegerType>:$shape,
-    Variadic<AnyIntegerType>:$shift,
-    Variadic<AnyIntegerType>:$slice,
-    Variadic<AnyCoordinateType>:$subcomponent,
-    Variadic<AnyIntegerType>:$substr,
-    Variadic<AnyIntegerType>:$lenParams,
-    Optional<fir_ClassType>:$sourceBox,
-    OptionalAttr<I32Attr>:$allocator_idx
-  );
+  let arguments = (ins AnyReferenceLike:$memref,
+      Variadic<AnyIntegerType>:$shape, Variadic<AnyIntegerType>:$shift,
+      Variadic<AnyIntegerType>:$slice,
+      Variadic<AnyCoordinateType>:$subcomponent,
+      Variadic<AnyIntegerType>:$substr, Variadic<AnyIntegerType>:$lenParams,
+      Optional<fir_ClassType>:$sourceBox, OptionalAttr<I32Attr>:$allocator_idx);
   let results = (outs BoxOrClassType);
 
   let assemblyFormat = [{
@@ -125,14 +120,10 @@ def fircg_XReboxOp : fircg_Op<"ext_rebox", [AttrSizedOperandSegments]> {
     There must not both be a shape and slice/subcomponent arguments
   }];
 
-  let arguments = (ins
-    BoxOrClassType:$box,
-    Variadic<AnyIntegerType>:$shape,
-    Variadic<AnyIntegerType>:$shift,
-    Variadic<AnyIntegerType>:$slice,
-    Variadic<AnyCoordinateType>:$subcomponent,
-    Variadic<AnyIntegerType>:$substr
-  );
+  let arguments = (ins BoxOrClassType:$box, Variadic<AnyIntegerType>:$shape,
+      Variadic<AnyIntegerType>:$shift, Variadic<AnyIntegerType>:$slice,
+      Variadic<AnyCoordinateType>:$subcomponent,
+      Variadic<AnyIntegerType>:$substr);
   let results = (outs BoxOrClassType);
 
   let assemblyFormat = [{
@@ -163,9 +154,9 @@ def fircg_XReboxOp : fircg_Op<"ext_rebox", [AttrSizedOperandSegments]> {
   }];
 }
 
-
 // Extended array coordinate operation.
-def fircg_XArrayCoorOp : fircg_Op<"ext_array_coor", [AttrSizedOperandSegments]> {
+def fircg_XArrayCoorOp
+    : fircg_Op<"ext_array_coor", [AttrSizedOperandSegments]> {
   let summary = "for internal conversion only";
 
   let description = [{
@@ -190,15 +181,11 @@ def fircg_XArrayCoorOp : fircg_Op<"ext_array_coor", [AttrSizedOperandSegments]>
     omitted otherwise. The rest of the arguments are optional.
   }];
 
-  let arguments = (ins
-    AnyRefOrBox:$memref,
-    Variadic<AnyIntegerType>:$shape,
-    Variadic<AnyIntegerType>:$shift,
-    Variadic<AnyIntegerType>:$slice,
-    Variadic<AnyCoordinateType>:$subcomponent,
-    Variadic<AnyCoordinateType>:$indices,
-    Variadic<AnyIntegerType>:$lenParams
-  );
+  let arguments = (ins AnyRefOrBox:$memref, Variadic<AnyIntegerType>:$shape,
+      Variadic<AnyIntegerType>:$shift, Variadic<AnyIntegerType>:$slice,
+      Variadic<AnyCoordinateType>:$subcomponent,
+      Variadic<AnyCoordinateType>:$indices,
+      Variadic<AnyIntegerType>:$lenParams);
   let results = (outs fir_ReferenceType);
 
   let assemblyFormat = [{
@@ -239,14 +226,9 @@ def fircg_XDeclareOp : fircg_Op<"ext_declare", [AttrSizedOperandSegments]> {
     be converted to an extended DeclareOp.
   }];
 
-  let arguments = (ins
-    AnyRefOrBox:$memref,
-    Variadic<AnyIntegerType>:$shape,
-    Variadic<AnyIntegerType>:$shift,
-    Variadic<AnyIntegerType>:$typeparams,
-    Optional<fir_DummyScopeType>:$dummy_scope,
-    Builtin_StringAttr:$uniq_name
-  );
+  let arguments = (ins AnyRefOrBox:$memref, Variadic<AnyIntegerType>:$shape,
+      Variadic<AnyIntegerType>:$shift, Variadic<AnyIntegerType>:$typeparams,
+      Optional<fir_DummyScopeType>:$dummy_scope, Builtin_StringAttr:$uniq_name);
   let results = (outs AnyRefOrBox);
 
   let assemblyFormat = [{

diff  --git a/flang/include/flang/Optimizer/Dialect/FIRCG/CMakeLists.txt b/flang/include/flang/Optimizer/Dialect/FIRCG/CMakeLists.txt
new file mode 100644
index 0000000000000..21f011dcca43a
--- /dev/null
+++ b/flang/include/flang/Optimizer/Dialect/FIRCG/CMakeLists.txt
@@ -0,0 +1,4 @@
+set(LLVM_TARGET_DEFINITIONS CGOps.td)
+mlir_tablegen(CGOps.h.inc -gen-op-decls)
+mlir_tablegen(CGOps.cpp.inc -gen-op-defs)
+add_public_tablegen_target(CGOpsIncGen)

diff  --git a/flang/lib/Frontend/CMakeLists.txt b/flang/lib/Frontend/CMakeLists.txt
index c80373799b015..f05b0403adfd5 100644
--- a/flang/lib/Frontend/CMakeLists.txt
+++ b/flang/lib/Frontend/CMakeLists.txt
@@ -33,6 +33,7 @@ add_flang_library(flangFrontend
   FIRSupport
   FIRBuilder
   FIRCodeGen
+  FIRCodeGenDialect
   FIRTransforms
   HLFIRDialect
   HLFIRTransforms

diff  --git a/flang/lib/Optimizer/CodeGen/CMakeLists.txt b/flang/lib/Optimizer/CodeGen/CMakeLists.txt
index f730c7fd03948..ed4e8b9ae87ed 100644
--- a/flang/lib/Optimizer/CodeGen/CMakeLists.txt
+++ b/flang/lib/Optimizer/CodeGen/CMakeLists.txt
@@ -1,6 +1,5 @@
 add_flang_library(FIRCodeGen
   BoxedProcedure.cpp
-  CGOps.cpp
   CodeGen.cpp
   CodeGenOpenMP.cpp
   FIROpPatterns.cpp
@@ -21,13 +20,12 @@ add_flang_library(FIRCodeGen
   CUFAttrs
   FIRAnalysis
   FIRBuilder
+  FIRCodeGenDialect
   FIRDialect
   FIRDialectSupport
   FIRSupport
 
   LINK_COMPONENTS
-  AsmParser
-  AsmPrinter
   Remarks
   TargetParser
 

diff  --git a/flang/lib/Optimizer/CodeGen/CodeGen.cpp b/flang/lib/Optimizer/CodeGen/CodeGen.cpp
index b54b497ee4ba1..907cac2bcaf65 100644
--- a/flang/lib/Optimizer/CodeGen/CodeGen.cpp
+++ b/flang/lib/Optimizer/CodeGen/CodeGen.cpp
@@ -12,11 +12,11 @@
 
 #include "flang/Optimizer/CodeGen/CodeGen.h"
 
-#include "flang/Optimizer/CodeGen/CGOps.h"
 #include "flang/Optimizer/CodeGen/CodeGenOpenMP.h"
 #include "flang/Optimizer/CodeGen/FIROpPatterns.h"
 #include "flang/Optimizer/CodeGen/TypeConverter.h"
 #include "flang/Optimizer/Dialect/FIRAttr.h"
+#include "flang/Optimizer/Dialect/FIRCG/CGOps.h"
 #include "flang/Optimizer/Dialect/FIRDialect.h"
 #include "flang/Optimizer/Dialect/FIROps.h"
 #include "flang/Optimizer/Dialect/FIRType.h"

diff  --git a/flang/lib/Optimizer/CodeGen/PreCGRewrite.cpp b/flang/lib/Optimizer/CodeGen/PreCGRewrite.cpp
index 86b81d8d652b2..d09d7d397e8b7 100644
--- a/flang/lib/Optimizer/CodeGen/PreCGRewrite.cpp
+++ b/flang/lib/Optimizer/CodeGen/PreCGRewrite.cpp
@@ -13,7 +13,7 @@
 #include "flang/Optimizer/CodeGen/CodeGen.h"
 
 #include "flang/Optimizer/Builder/Todo.h" // remove when TODO's are done
-#include "flang/Optimizer/CodeGen/CGOps.h"
+#include "flang/Optimizer/Dialect/FIRCG/CGOps.h"
 #include "flang/Optimizer/Dialect/FIRDialect.h"
 #include "flang/Optimizer/Dialect/FIROps.h"
 #include "flang/Optimizer/Dialect/FIRType.h"

diff  --git a/flang/lib/Optimizer/Dialect/CMakeLists.txt b/flang/lib/Optimizer/Dialect/CMakeLists.txt
index 61f9c6110491e..6afb993e52c54 100644
--- a/flang/lib/Optimizer/Dialect/CMakeLists.txt
+++ b/flang/lib/Optimizer/Dialect/CMakeLists.txt
@@ -1,5 +1,6 @@
 add_subdirectory(Support)
 add_subdirectory(CUF)
+add_subdirectory(FIRCG)
 
 add_flang_library(FIRDialect
   FIRAttr.cpp

diff  --git a/flang/lib/Optimizer/CodeGen/CGOps.cpp b/flang/lib/Optimizer/Dialect/FIRCG/CGOps.cpp
similarity index 92%
rename from flang/lib/Optimizer/CodeGen/CGOps.cpp
rename to flang/lib/Optimizer/Dialect/FIRCG/CGOps.cpp
index 6b8ba74525556..19ad6bed512c7 100644
--- a/flang/lib/Optimizer/CodeGen/CGOps.cpp
+++ b/flang/lib/Optimizer/Dialect/FIRCG/CGOps.cpp
@@ -10,7 +10,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "flang/Optimizer/CodeGen/CGOps.h"
+#include "flang/Optimizer/Dialect/FIRCG/CGOps.h"
 #include "flang/Optimizer/Dialect/FIRDialect.h"
 #include "flang/Optimizer/Dialect/FIROps.h"
 #include "flang/Optimizer/Dialect/FIRType.h"
@@ -20,7 +20,7 @@ fir::FIRCodeGenDialect::FIRCodeGenDialect(mlir::MLIRContext *ctx)
     : mlir::Dialect("fircg", ctx, mlir::TypeID::get<FIRCodeGenDialect>()) {
   addOperations<
 #define GET_OP_LIST
-#include "flang/Optimizer/CodeGen/CGOps.cpp.inc"
+#include "flang/Optimizer/Dialect/FIRCG/CGOps.cpp.inc"
       >();
 }
 
@@ -30,7 +30,7 @@ fir::FIRCodeGenDialect::~FIRCodeGenDialect() {
 }
 
 #define GET_OP_CLASSES
-#include "flang/Optimizer/CodeGen/CGOps.cpp.inc"
+#include "flang/Optimizer/Dialect/FIRCG/CGOps.cpp.inc"
 
 unsigned fir::cg::XEmboxOp::getOutRank() {
   if (getSlice().empty())

diff  --git a/flang/lib/Optimizer/Dialect/FIRCG/CMakeLists.txt b/flang/lib/Optimizer/Dialect/FIRCG/CMakeLists.txt
new file mode 100644
index 0000000000000..107d567056b59
--- /dev/null
+++ b/flang/lib/Optimizer/Dialect/FIRCG/CMakeLists.txt
@@ -0,0 +1,14 @@
+add_flang_library(FIRCodeGenDialect
+  CGOps.cpp
+
+  DEPENDS
+  CGOpsIncGen
+
+  LINK_LIBS
+  FIRDialect
+  MLIRIR
+
+  LINK_COMPONENTS
+  AsmParser
+  AsmPrinter
+  )

diff  --git a/flang/lib/Optimizer/OpenACC/CMakeLists.txt b/flang/lib/Optimizer/OpenACC/CMakeLists.txt
index 4a09133fc110d..5ce5796872357 100644
--- a/flang/lib/Optimizer/OpenACC/CMakeLists.txt
+++ b/flang/lib/Optimizer/OpenACC/CMakeLists.txt
@@ -6,7 +6,6 @@ add_flang_library(FIROpenACCSupport
 
   DEPENDS
   FIRBuilder
-  FIRCodeGen
   FIRDialect
   FIRDialectSupport
   FIRSupport
@@ -14,7 +13,7 @@ add_flang_library(FIROpenACCSupport
 
   LINK_LIBS
   FIRBuilder
-  FIRCodeGen
+  FIRCodeGenDialect
   FIRDialect
   FIRDialectSupport
   FIRSupport

diff  --git a/flang/lib/Optimizer/OpenACC/FIROpenACCTypeInterfaces.cpp b/flang/lib/Optimizer/OpenACC/FIROpenACCTypeInterfaces.cpp
index 0ebc62e7f2fd6..38c9fc5bbb52c 100644
--- a/flang/lib/Optimizer/OpenACC/FIROpenACCTypeInterfaces.cpp
+++ b/flang/lib/Optimizer/OpenACC/FIROpenACCTypeInterfaces.cpp
@@ -15,7 +15,7 @@
 #include "flang/Optimizer/Builder/DirectivesCommon.h"
 #include "flang/Optimizer/Builder/FIRBuilder.h"
 #include "flang/Optimizer/Builder/HLFIRTools.h"
-#include "flang/Optimizer/CodeGen/CGOps.h"
+#include "flang/Optimizer/Dialect/FIRCG/CGOps.h"
 #include "flang/Optimizer/Dialect/FIROps.h"
 #include "flang/Optimizer/Dialect/FIROpsSupport.h"
 #include "flang/Optimizer/Dialect/FIRType.h"

diff  --git a/flang/lib/Optimizer/Transforms/AddDebugInfo.cpp b/flang/lib/Optimizer/Transforms/AddDebugInfo.cpp
index e9a94efcdd675..c479c1a0892b5 100644
--- a/flang/lib/Optimizer/Transforms/AddDebugInfo.cpp
+++ b/flang/lib/Optimizer/Transforms/AddDebugInfo.cpp
@@ -14,7 +14,7 @@
 #include "DebugTypeGenerator.h"
 #include "flang/Optimizer/Builder/FIRBuilder.h"
 #include "flang/Optimizer/Builder/Todo.h"
-#include "flang/Optimizer/CodeGen/CGOps.h"
+#include "flang/Optimizer/Dialect/FIRCG/CGOps.h"
 #include "flang/Optimizer/Dialect/FIRDialect.h"
 #include "flang/Optimizer/Dialect/FIROps.h"
 #include "flang/Optimizer/Dialect/FIROpsSupport.h"

diff  --git a/flang/lib/Optimizer/Transforms/CMakeLists.txt b/flang/lib/Optimizer/Transforms/CMakeLists.txt
index ca08e4607e019..170b6e2cca225 100644
--- a/flang/lib/Optimizer/Transforms/CMakeLists.txt
+++ b/flang/lib/Optimizer/Transforms/CMakeLists.txt
@@ -47,6 +47,7 @@ add_flang_library(FIRTransforms
   FIRAnalysis
   FIRBuilder
   FIRCodeGen
+  FIRCodeGenDialect
   FIRDialect
   FIRDialectSupport
   FIRSupport

diff  --git a/flang/lib/Optimizer/Transforms/DebugTypeGenerator.h b/flang/lib/Optimizer/Transforms/DebugTypeGenerator.h
index cc4b5428ee1a9..93b9ac2d90fdf 100644
--- a/flang/lib/Optimizer/Transforms/DebugTypeGenerator.h
+++ b/flang/lib/Optimizer/Transforms/DebugTypeGenerator.h
@@ -13,8 +13,8 @@
 #ifndef FORTRAN_OPTIMIZER_TRANSFORMS_DEBUGTYPEGENERATOR_H
 #define FORTRAN_OPTIMIZER_TRANSFORMS_DEBUGTYPEGENERATOR_H
 
-#include "flang/Optimizer/CodeGen/CGOps.h"
 #include "flang/Optimizer/CodeGen/TypeConverter.h"
+#include "flang/Optimizer/Dialect/FIRCG/CGOps.h"
 #include "flang/Optimizer/Dialect/FIRType.h"
 #include "flang/Optimizer/Dialect/Support/FIRContext.h"
 #include "flang/Optimizer/Dialect/Support/KindMapping.h"

diff  --git a/flang/tools/fir-opt/CMakeLists.txt b/flang/tools/fir-opt/CMakeLists.txt
index efbde329b8b8c..20a47b63770a5 100644
--- a/flang/tools/fir-opt/CMakeLists.txt
+++ b/flang/tools/fir-opt/CMakeLists.txt
@@ -18,6 +18,7 @@ target_link_libraries(fir-opt PRIVATE
   FIRSupport
   FIRTransforms
   FIRCodeGen
+  FIRCodeGenDialect
   HLFIRDialect
   HLFIRTransforms
   FIROpenACCSupport

diff  --git a/flang/tools/tco/CMakeLists.txt b/flang/tools/tco/CMakeLists.txt
index c277cdbf167b6..fcbedb0893d1e 100644
--- a/flang/tools/tco/CMakeLists.txt
+++ b/flang/tools/tco/CMakeLists.txt
@@ -10,6 +10,7 @@ target_link_libraries(tco PRIVATE
   CUFAttrs
   CUFDialect
   FIRCodeGen
+  FIRCodeGenDialect
   FIRDialect
   FIRDialectSupport
   FIRSupport

diff  --git a/flang/unittests/Optimizer/CMakeLists.txt b/flang/unittests/Optimizer/CMakeLists.txt
index 1289341619118..a84d54d96102a 100644
--- a/flang/unittests/Optimizer/CMakeLists.txt
+++ b/flang/unittests/Optimizer/CMakeLists.txt
@@ -8,7 +8,7 @@ set(LLVM_LINK_COMPONENTS
 set(LIBS
   CUFDialect
   FIRBuilder
-  FIRCodeGen
+  FIRCodeGenDialect
   FIRDialect
   FIRDialectSupport
   FIRSupport


        


More information about the flang-commits mailing list