From 1e2a48787a3d33c6253fe414901ae2903b51e229 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Wed, 24 Sep 2025 10:54:00 +0200 Subject: [PATCH 1/2] [MLIR][CMake] Suppress -Wpass-failed warning libstdc++15 makes use of an unroll pragma inside std::find_if(). This produces a warning if clang fails to unroll the loop. As this pragma is outside of our control, suppress the warning. --- mlir/CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mlir/CMakeLists.txt b/mlir/CMakeLists.txt index 1a211f5495764..da340c4e36784 100644 --- a/mlir/CMakeLists.txt +++ b/mlir/CMakeLists.txt @@ -110,6 +110,12 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU") endif() endif() +# libstdc++15 makes use of an unroll pragma inside std::find_if(). This +# produces a warning if clang fails to unroll the loop. As this pragma is +# outside of our control, suppress the warning. +check_cxx_compiler_flag("-Wno-pass-failed" CXX_SUPPORTS_WNO_PASS_FAILED) +append_if(CXX_SUPPORTS_WNO_PASS_FAILED "-Wno-pass-failed" CMAKE_CXX_FLAGS) + # Installing the headers and docs needs to depend on generating any public # tablegen'd targets. # mlir-generic-headers are dialect-independent. From f203d441910b88276f647f8a6ba93e827d5dcc26 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Mon, 29 Sep 2025 12:38:11 +0200 Subject: [PATCH 2/2] Move to llvm, add FIXME to possibly remove it again --- llvm/cmake/modules/HandleLLVMOptions.cmake | 7 +++++++ mlir/CMakeLists.txt | 6 ------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/llvm/cmake/modules/HandleLLVMOptions.cmake b/llvm/cmake/modules/HandleLLVMOptions.cmake index 8eca29f8a03f5..6d61e0919400e 100644 --- a/llvm/cmake/modules/HandleLLVMOptions.cmake +++ b/llvm/cmake/modules/HandleLLVMOptions.cmake @@ -962,6 +962,13 @@ if (LLVM_ENABLE_WARNINGS AND (LLVM_COMPILER_IS_GCC_COMPATIBLE OR CLANG_CL)) # Enable -Wctad-maybe-unsupported to catch unintended use of CTAD. add_flag_if_supported("-Wctad-maybe-unsupported" CTAD_MAYBE_UNSPPORTED_FLAG) + + # Disable -Wno-pass-failed flag, which reports failure to perform + # optimizations suggested by pragmas. This warning is not relevant for LLVM + # projects and may be injected by pragmas in libstdc++. + # FIXME: Reconsider this choice if warnings from STL headers can be reliably + # avoided (https://github.com/llvm/llvm-project/issues/157666). + add_flag_if_supported("-Wno-pass-failed" NO_PASS_FAILED_FLAG) endif (LLVM_ENABLE_WARNINGS AND (LLVM_COMPILER_IS_GCC_COMPATIBLE OR CLANG_CL)) if (LLVM_COMPILER_IS_GCC_COMPATIBLE AND NOT LLVM_ENABLE_WARNINGS) diff --git a/mlir/CMakeLists.txt b/mlir/CMakeLists.txt index da340c4e36784..1a211f5495764 100644 --- a/mlir/CMakeLists.txt +++ b/mlir/CMakeLists.txt @@ -110,12 +110,6 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU") endif() endif() -# libstdc++15 makes use of an unroll pragma inside std::find_if(). This -# produces a warning if clang fails to unroll the loop. As this pragma is -# outside of our control, suppress the warning. -check_cxx_compiler_flag("-Wno-pass-failed" CXX_SUPPORTS_WNO_PASS_FAILED) -append_if(CXX_SUPPORTS_WNO_PASS_FAILED "-Wno-pass-failed" CMAKE_CXX_FLAGS) - # Installing the headers and docs needs to depend on generating any public # tablegen'd targets. # mlir-generic-headers are dialect-independent.