Skip to content

release/20.x: Fixes for flang/mlir dependencies #125837

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 11, 2025

Conversation

nikic
Copy link
Contributor

@nikic nikic commented Feb 5, 2025

Backport a few fixes for flang/MLIR library dependencies related to MLIR_LINK_MLIR_DYLIB changes.

@nikic nikic added this to the LLVM 20.X Release milestone Feb 5, 2025
@nikic nikic requested a review from mgorny February 5, 2025 11:01
@llvmbot llvmbot added mlir flang Flang issues not falling into any other category flang:fir-hlfir labels Feb 5, 2025
@llvmbot
Copy link
Member

llvmbot commented Feb 5, 2025

@llvm/pr-subscribers-flang-fir-hlfir

@llvm/pr-subscribers-mlir

Author: Nikita Popov (nikic)

Changes

Backport a few fixes for flang/MLIR library dependencies related to MLIR_LINK_MLIR_DYLIB changes.


Full diff: https://github.com/llvm/llvm-project/pull/125837.diff

3 Files Affected:

  • (modified) flang/lib/Optimizer/Analysis/CMakeLists.txt (+1-1)
  • (modified) flang/tools/bbc/CMakeLists.txt (+5-5)
  • (modified) mlir/test/lib/IR/CMakeLists.txt (+3-1)
diff --git a/flang/lib/Optimizer/Analysis/CMakeLists.txt b/flang/lib/Optimizer/Analysis/CMakeLists.txt
index 6fe9c70f83765f1..c4dae898f8e5722 100644
--- a/flang/lib/Optimizer/Analysis/CMakeLists.txt
+++ b/flang/lib/Optimizer/Analysis/CMakeLists.txt
@@ -12,6 +12,7 @@ add_flang_library(FIRAnalysis
   LINK_LIBS
   FIRBuilder
   FIRDialect
+  FIRSupport
   HLFIRDialect
 
   MLIR_LIBS
@@ -19,5 +20,4 @@ add_flang_library(FIRAnalysis
   MLIRLLVMDialect
   MLIRMathTransforms
   MLIROpenMPDialect
-  FIRSupport
 )
diff --git a/flang/tools/bbc/CMakeLists.txt b/flang/tools/bbc/CMakeLists.txt
index 85aeb85e0c53093..97462be83ea4389 100644
--- a/flang/tools/bbc/CMakeLists.txt
+++ b/flang/tools/bbc/CMakeLists.txt
@@ -29,6 +29,11 @@ target_link_libraries(bbc PRIVATE
   flangFrontend
   flangPasses
   FlangOpenMPTransforms
+  FortranCommon
+  FortranParser
+  FortranEvaluate
+  FortranSemantics
+  FortranLower
 )
 
 mlir_target_link_libraries(bbc PRIVATE
@@ -36,9 +41,4 @@ mlir_target_link_libraries(bbc PRIVATE
   ${extension_libs}
   MLIRAffineToStandard
   MLIRSCFToControlFlow
-  FortranCommon
-  FortranParser
-  FortranEvaluate
-  FortranSemantics
-  FortranLower
 )
diff --git a/mlir/test/lib/IR/CMakeLists.txt b/mlir/test/lib/IR/CMakeLists.txt
index e5416da70d50080..71a96c7f92c0c7d 100644
--- a/mlir/test/lib/IR/CMakeLists.txt
+++ b/mlir/test/lib/IR/CMakeLists.txt
@@ -27,13 +27,15 @@ add_mlir_library(MLIRTestIR
   TestVisitorsGeneric.cpp
 
   EXCLUDE_FROM_LIBMLIR
+
+  LINK_LIBS PUBLIC
+  MLIRTestDialect
   )
 mlir_target_link_libraries(MLIRTestIR PUBLIC
   MLIRPass
   MLIRBytecodeReader
   MLIRBytecodeWriter
   MLIRFunctionInterfaces
-  MLIRTestDialect
   )
 
 target_include_directories(MLIRTestIR

This is a test library which is not part of libMLIR, so it should
use normal LINK_LIBS instead of mlir_target_link_libraries.

This fixes an issue introduced in llvm#123910 and follows up on the
fix in llvm#125004, which added the library to DEPENDS, which is not
sufficient.
This library is provided by flang, not MLIR, so it should not be part of
MLIR_LIBS.

Fixes an issue introduced in llvm#120966.

(cherry picked from commit ee76bda)
The Fortran libraries are not part of MLIR, so they should use
target_link_libraries() rather than mlir_target_link_libraries().

This fixes an issue introduced in
llvm#120966.

(cherry picked from commit f9af5c1)
@nikic nikic force-pushed the flang-libs-backports branch from 29f3a87 to 4c4ed5e Compare February 11, 2025 13:59
@tstellar tstellar merged commit 4c4ed5e into llvm:release/20.x Feb 11, 2025
11 checks passed
Copy link

@nikic (or anyone else). If you would like to add a note about this fix in the release notes (completely optional). Please reply to this comment with a one or two sentence description of the fix. When you are done, please add the release:note label to this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flang:fir-hlfir flang Flang issues not falling into any other category mlir
Projects
Development

Successfully merging this pull request may close these issues.

4 participants