[Mlir-commits] [mlir] [MLIR] Default PDL off for dependency-only builds (PR #233108)

Mehdi Amini llvmlistbot at llvm.org
Sat Oct 17 09:03:26 PDT 2026


https://github.com/joker-eph created https://github.com/llvm/llvm-project/pull/233108

Default PDL support in PatternMatch to off whenever MLIR is configured only as a dependency. Keep the existing default for explicitly enabled MLIR builds and preserve user-provided PDL settings. This speeds up clang build with CIR enabled.

Assisted-by: Codex

>From 05800f8172bf7268791f7a82f0d69b7ce2249097 Mon Sep 17 00:00:00 2001
From: Mehdi Amini <joker.eph at gmail.com>
Date: Sat, 17 Oct 2026 08:41:10 -0700
Subject: [PATCH] [MLIR] Default PDL off for dependency-only builds

Default PDL support in PatternMatch to off whenever MLIR is configured
only as a dependency. Keep the existing default for explicitly enabled
MLIR builds and preserve user-provided PDL settings.

Assisted-by: Codex
---
 mlir/CMakeLists.txt | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/mlir/CMakeLists.txt b/mlir/CMakeLists.txt
index 68df5aed001e2e..f2c9d29af17e43 100644
--- a/mlir/CMakeLists.txt
+++ b/mlir/CMakeLists.txt
@@ -151,7 +151,15 @@ set(MLIR_ENABLE_NVPTXCOMPILER 0 CACHE BOOL
     "Statically link the nvptxlibrary instead of calling ptxas as a subprocess \
     for compiling PTX to cubin")
 
-set(MLIR_ENABLE_PDL_IN_PATTERNMATCH 1 CACHE BOOL "Enable PDL in PatternMatch")
+# Avoid pulling PDL into builds that only use MLIR as a dependency.
+if("mlir" IN_LIST LLVM_DEPENDENCY_ONLY_PROJECTS)
+  set(MLIR_ENABLE_PDL_IN_PATTERNMATCH_default 0)
+else()
+  set(MLIR_ENABLE_PDL_IN_PATTERNMATCH_default 1)
+endif()
+set(MLIR_ENABLE_PDL_IN_PATTERNMATCH
+    ${MLIR_ENABLE_PDL_IN_PATTERNMATCH_default} CACHE BOOL
+    "Enable PDL in PatternMatch")
 
 option(MLIR_INCLUDE_TESTS
        "Generate build targets for the MLIR unit tests."



More information about the Mlir-commits mailing list