[llvm] [MLGO] Gate model tests on optimization-specific lit features (PR #217906)

via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 21 11:12:56 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlgo

Author: ioana ghiban (ioghiban)

<details>
<summary>Changes</summary>

### Context

`have_mlir_lowering` only indicates that `LLVM_MLGO_MODELS` is non-empty. It does not identify which model type was compiled.

### Motivation

An inliner-only configuration incorrectly enabled regalloc-specific test commands, and vice versa.

### Changes

Add `have_mlir_lowering_inliner` and `have_mlir_lowering_regalloc` lit features derived from the corresponding model-generation targets. Update MLGO tests to use the appropriate model-specific feature, including GN configuration defaults.


I leveraged AI to write this PR.

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


17 Files Affected:

- (modified) llvm/test/CMakeLists.txt (+10) 
- (modified) llvm/test/CodeGen/MLRegAlloc/default-eviction-advisor.ll (+2-2) 
- (modified) llvm/test/CodeGen/MLRegAlloc/rel-codepath.ll (+3-3) 
- (modified) llvm/test/Transforms/Inline/ML/bounds-checks.ll (+3-3) 
- (modified) llvm/test/Transforms/Inline/ML/coro-split-func-levels.ll (+2-2) 
- (modified) llvm/test/Transforms/Inline/ML/dead-callee.ll (+2-2) 
- (modified) llvm/test/Transforms/Inline/ML/enable-inline-advisor-printing-ml.ll (+3-3) 
- (modified) llvm/test/Transforms/Inline/ML/fpi-update.ll (+2-2) 
- (modified) llvm/test/Transforms/Inline/ML/ml-test-release-mode.ll (+2-2) 
- (modified) llvm/test/Transforms/Inline/ML/recursive.ll (+2-2) 
- (modified) llvm/test/Transforms/Inline/ML/scc-dead-accounting.ll (+2-2) 
- (modified) llvm/test/Transforms/Inline/ML/skip-unreachable.ll (+2-2) 
- (modified) llvm/test/Transforms/Inline/ML/state-accounting-skip-non-cold.ll (+3-3) 
- (modified) llvm/test/Transforms/Inline/inlining-advisor-default.ll (+3-3) 
- (modified) llvm/test/lit.cfg.py (+6) 
- (modified) llvm/test/lit.site.cfg.py.in (+2) 
- (modified) llvm/utils/gn/secondary/llvm/test/BUILD.gn (+2-1) 


``````````diff
diff --git a/llvm/test/CMakeLists.txt b/llvm/test/CMakeLists.txt
index a2269597fe5e6..96ed4ea27c126 100644
--- a/llvm/test/CMakeLists.txt
+++ b/llvm/test/CMakeLists.txt
@@ -1,3 +1,11 @@
+if(TARGET mlgo_models_gen_inliner)
+  set(LLVM_HAVE_MLIR_LOWERING_INLINER ON)
+endif()
+
+if(TARGET mlgo_models_gen_regalloc)
+  set(LLVM_HAVE_MLIR_LOWERING_REGALLOC ON)
+endif()
+
 llvm_canonicalize_cmake_booleans(
   BUILD_SHARED_LIBS
   HAVE_OCAMLOPT
@@ -20,6 +28,8 @@ llvm_canonicalize_cmake_booleans(
   LLVM_HAVE_TF_AOT
   LLVM_HAVE_TFLITE
   LLVM_HAVE_MLIR_LOWERING
+  LLVM_HAVE_MLIR_LOWERING_INLINER
+  LLVM_HAVE_MLIR_LOWERING_REGALLOC
   LLVM_ENABLE_PROFCHECK
   LLVM_INLINER_MODEL_AUTOGENERATED
   LLVM_RAEVICT_MODEL_AUTOGENERATED
diff --git a/llvm/test/CodeGen/MLRegAlloc/default-eviction-advisor.ll b/llvm/test/CodeGen/MLRegAlloc/default-eviction-advisor.ll
index f9509e57e1ff1..b1bc9b15568be 100644
--- a/llvm/test/CodeGen/MLRegAlloc/default-eviction-advisor.ll
+++ b/llvm/test/CodeGen/MLRegAlloc/default-eviction-advisor.ll
@@ -6,8 +6,8 @@
 ; RUN: not llc -O2 -regalloc-enable-advisor=development < %s 2>&1 | FileCheck %s
 ; RUN: not llc -O2 -regalloc-enable-advisor=release < %s 2>&1 | FileCheck %s
 ; RUN: llc -O2 -regalloc-enable-advisor=default < %s 2>&1 | FileCheck %s --check-prefix=DEFAULT
-; RUN: %if have_mlir_lowering %{ not llc -O2 -regalloc-enable-advisor=release -regalloc-mlgo-model=default < %s 2>&1 | FileCheck %s %}
-; RUN: %if have_mlir_lowering %{ not llc -O2 -regalloc-enable-advisor=release -regalloc-mlgo-model=invalid_model < %s 2>&1 | FileCheck %s --check-prefix=INVALID %}
+; RUN: %if have_mlir_lowering_regalloc %{ not llc -O2 -regalloc-enable-advisor=release -regalloc-mlgo-model=default < %s 2>&1 | FileCheck %s %}
+; RUN: %if have_mlir_lowering_regalloc %{ not llc -O2 -regalloc-enable-advisor=release -regalloc-mlgo-model=invalid_model < %s 2>&1 | FileCheck %s --check-prefix=INVALID %}
 
 ; regalloc-enable-advisor is not enabled for NVPTX
 ; UNSUPPORTED: target=nvptx{{.*}}
diff --git a/llvm/test/CodeGen/MLRegAlloc/rel-codepath.ll b/llvm/test/CodeGen/MLRegAlloc/rel-codepath.ll
index d426ce6f8f3e3..1e42954a5cdc8 100644
--- a/llvm/test/CodeGen/MLRegAlloc/rel-codepath.ll
+++ b/llvm/test/CodeGen/MLRegAlloc/rel-codepath.ll
@@ -1,6 +1,6 @@
-; REQUIRES: have_tf_aot || have_mlir_lowering
+; REQUIRES: have_tf_aot || have_mlir_lowering_regalloc
 ; REQUIRES: x86_64-linux
-; REQUIRES: llvm_raevict_model_autogenerated || have_mlir_lowering
+; REQUIRES: llvm_raevict_model_autogenerated || have_mlir_lowering_regalloc
 ;
 ; Check the code path for release mode is correctly taken. It is shared with
 ; development mode, and we separately test the internals of that (logged
@@ -10,7 +10,7 @@
 ; RUN: llc -mtriple=x86_64-linux-unknown -regalloc=greedy -regalloc-enable-advisor=default \
 ; RUN:   %S/Inputs/input.ll -o %t.default
 
-; RUN: llc -mtriple=x86_64-linux-unknown -regalloc=greedy %if have_mlir_lowering %{ -regalloc-enable-advisor=release -regalloc-mlgo-model=regalloc %} %else %{ -regalloc-enable-advisor=release %} \
+; RUN: llc -mtriple=x86_64-linux-unknown -regalloc=greedy %if have_mlir_lowering_regalloc %{ -regalloc-enable-advisor=release -regalloc-mlgo-model=regalloc %} %else %{ -regalloc-enable-advisor=release %} \
 ; RUN:   %S/Inputs/input.ll -o %t.release
 
 ; RUN: not diff %t.release %t.default
diff --git a/llvm/test/Transforms/Inline/ML/bounds-checks.ll b/llvm/test/Transforms/Inline/ML/bounds-checks.ll
index f1e2911a2004c..d796b1cba9aa2 100644
--- a/llvm/test/Transforms/Inline/ML/bounds-checks.ll
+++ b/llvm/test/Transforms/Inline/ML/bounds-checks.ll
@@ -2,9 +2,9 @@
 ; In all cases, the end result is the same: mandatory inlinings must happen.
 ; However, when we discover we 'trip' over the artificially-low size increase
 ; factor, we don't inline anymore.
-; REQUIRES: llvm_inliner_model_autogenerated || have_mlir_lowering
-; RUN: opt -passes=scc-oz-module-inliner %if have_mlir_lowering %{ -enable-ml-inliner=release -mlgo-model=inliner %} %else %{ -enable-ml-inliner=release %} -ml-advisor-size-increase-threshold=10.0 -S < %s 2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=NOBOUNDS
-; RUN: opt -passes=scc-oz-module-inliner %if have_mlir_lowering %{ -enable-ml-inliner=release -mlgo-model=inliner %} %else %{ -enable-ml-inliner=release %} -ml-advisor-size-increase-threshold=1.0 -S < %s 2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=BOUNDS
+; REQUIRES: llvm_inliner_model_autogenerated || have_mlir_lowering_inliner
+; RUN: opt -passes=scc-oz-module-inliner %if have_mlir_lowering_inliner %{ -enable-ml-inliner=release -mlgo-model=inliner %} %else %{ -enable-ml-inliner=release %} -ml-advisor-size-increase-threshold=10.0 -S < %s 2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=NOBOUNDS
+; RUN: opt -passes=scc-oz-module-inliner %if have_mlir_lowering_inliner %{ -enable-ml-inliner=release -mlgo-model=inliner %} %else %{ -enable-ml-inliner=release %} -ml-advisor-size-increase-threshold=1.0 -S < %s 2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=BOUNDS
 
 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-grtev4-linux-gnu"
diff --git a/llvm/test/Transforms/Inline/ML/coro-split-func-levels.ll b/llvm/test/Transforms/Inline/ML/coro-split-func-levels.ll
index b3660cb7c5646..bb14ea327069c 100644
--- a/llvm/test/Transforms/Inline/ML/coro-split-func-levels.ll
+++ b/llvm/test/Transforms/Inline/ML/coro-split-func-levels.ll
@@ -1,6 +1,6 @@
-; REQUIRES: llvm_inliner_model_autogenerated || have_mlir_lowering
+; REQUIRES: llvm_inliner_model_autogenerated || have_mlir_lowering_inliner
 ; RUN: opt -S -passes='coro-early,scc-oz-module-inliner,print<inline-advisor>' \
-; RUN:  %if have_mlir_lowering %{ -enable-ml-inliner=release -mlgo-model=inliner %} %else %{ -enable-ml-inliner=release %} -keep-inline-advisor-for-printing < %s
+; RUN:  %if have_mlir_lowering_inliner %{ -enable-ml-inliner=release -mlgo-model=inliner %} %else %{ -enable-ml-inliner=release %} -keep-inline-advisor-for-printing < %s
 
 define void @_Z5get_sv() presplitcoroutine {
   %1 = call token @llvm.coro.id(i32 0, ptr null, ptr null, ptr null)
diff --git a/llvm/test/Transforms/Inline/ML/dead-callee.ll b/llvm/test/Transforms/Inline/ML/dead-callee.ll
index 34d44eda1a625..ffb2b53f1b027 100644
--- a/llvm/test/Transforms/Inline/ML/dead-callee.ll
+++ b/llvm/test/Transforms/Inline/ML/dead-callee.ll
@@ -1,5 +1,5 @@
-; REQUIRES: llvm_inliner_model_autogenerated || have_mlir_lowering
-; RUN: opt %if have_mlir_lowering %{ -passes=inliner-ml-advisor-release -mlgo-model=inliner %} %else %{ -passes=inliner-ml-advisor-release %} -S < %s | FileCheck %s
+; REQUIRES: llvm_inliner_model_autogenerated || have_mlir_lowering_inliner
+; RUN: opt %if have_mlir_lowering_inliner %{ -passes=inliner-ml-advisor-release -mlgo-model=inliner %} %else %{ -passes=inliner-ml-advisor-release %} -S < %s | FileCheck %s
 
 ; Check that our accounting works when a function in a non-trivial SCC is dead.
 
diff --git a/llvm/test/Transforms/Inline/ML/enable-inline-advisor-printing-ml.ll b/llvm/test/Transforms/Inline/ML/enable-inline-advisor-printing-ml.ll
index f72fb741cc037..de414f0bcb457 100644
--- a/llvm/test/Transforms/Inline/ML/enable-inline-advisor-printing-ml.ll
+++ b/llvm/test/Transforms/Inline/ML/enable-inline-advisor-printing-ml.ll
@@ -1,10 +1,10 @@
-; REQUIRES: llvm_inliner_model_autogenerated || have_mlir_lowering
+; REQUIRES: llvm_inliner_model_autogenerated || have_mlir_lowering_inliner
 
-; RUN: opt %if have_mlir_lowering %{ -enable-ml-inliner=release -mlgo-model=inliner %} %else %{ -enable-ml-inliner=release %} -passes=scc-oz-module-inliner \
+; RUN: opt %if have_mlir_lowering_inliner %{ -enable-ml-inliner=release -mlgo-model=inliner %} %else %{ -enable-ml-inliner=release %} -passes=scc-oz-module-inliner \
 ; RUN:     -keep-inline-advisor-for-printing -mandatory-inlining-first=1 \
 ; RUN:     -enable-scc-inline-advisor-printing -S < %s 2>&1 | FileCheck %s
 
-; RUN: opt %if have_mlir_lowering %{ -enable-ml-inliner=release -mlgo-model=inliner %} %else %{ -enable-ml-inliner=release %} -passes=scc-oz-module-inliner \
+; RUN: opt %if have_mlir_lowering_inliner %{ -enable-ml-inliner=release -mlgo-model=inliner %} %else %{ -enable-ml-inliner=release %} -passes=scc-oz-module-inliner \
 ; RUN:     -keep-inline-advisor-for-printing -mandatory-inlining-first=0 \
 ; RUN:     -enable-scc-inline-advisor-printing -S < %s 2>&1 \
 ; RUN:     | FileCheck %s --check-prefix=TWO
diff --git a/llvm/test/Transforms/Inline/ML/fpi-update.ll b/llvm/test/Transforms/Inline/ML/fpi-update.ll
index 2a3fa12616629..0799bb9edc0aa 100644
--- a/llvm/test/Transforms/Inline/ML/fpi-update.ll
+++ b/llvm/test/Transforms/Inline/ML/fpi-update.ll
@@ -3,9 +3,9 @@ target triple = "x86_64-grtev4-linux-gnu"
 
 ; TODO: we could instantiate the MLInliner with a non-model generated evaluator
 ; and drop the requirement
-; REQUIRES: llvm_inliner_model_autogenerated || have_mlir_lowering
+; REQUIRES: llvm_inliner_model_autogenerated || have_mlir_lowering_inliner
 
-; RUN: opt %if have_mlir_lowering %{ -enable-ml-inliner=release -mlgo-model=inliner %} %else %{ -enable-ml-inliner=release %} -passes='scc-oz-module-inliner,print<inline-advisor>' \
+; RUN: opt %if have_mlir_lowering_inliner %{ -enable-ml-inliner=release -mlgo-model=inliner %} %else %{ -enable-ml-inliner=release %} -passes='scc-oz-module-inliner,print<inline-advisor>' \
 ; RUN:     -keep-inline-advisor-for-printing -max-devirt-iterations=0 \
 ; RUN:     -mandatory-inlining-first=0 -S < %s 2>&1 | FileCheck %s 
 
diff --git a/llvm/test/Transforms/Inline/ML/ml-test-release-mode.ll b/llvm/test/Transforms/Inline/ML/ml-test-release-mode.ll
index 711652a197fbf..7e0aaa592f072 100644
--- a/llvm/test/Transforms/Inline/ML/ml-test-release-mode.ll
+++ b/llvm/test/Transforms/Inline/ML/ml-test-release-mode.ll
@@ -5,6 +5,6 @@
 ; This test uses Inputs/test-module.ll, as it will share it with a similar test
 ; for the 'development' mode.
 ;
-; REQUIRES: llvm_inliner_model_autogenerated || have_mlir_lowering
-; RUN: opt -passes=scc-oz-module-inliner %if have_mlir_lowering %{ -enable-ml-inliner=release -mlgo-model=inliner %} %else %{ -enable-ml-inliner=release %} -S < %S/Inputs/test-module.ll 2>&1 | FileCheck %S/Inputs/test-module.ll --check-prefix=CHECK
+; REQUIRES: llvm_inliner_model_autogenerated || have_mlir_lowering_inliner
+; RUN: opt -passes=scc-oz-module-inliner %if have_mlir_lowering_inliner %{ -enable-ml-inliner=release -mlgo-model=inliner %} %else %{ -enable-ml-inliner=release %} -S < %S/Inputs/test-module.ll 2>&1 | FileCheck %S/Inputs/test-module.ll --check-prefix=CHECK
 ; RUN: opt -passes=scc-oz-module-inliner -enable-ml-inliner=default -S < %S/Inputs/test-module.ll 2>&1 | FileCheck %S/Inputs/test-module.ll --check-prefix=DEFAULT
diff --git a/llvm/test/Transforms/Inline/ML/recursive.ll b/llvm/test/Transforms/Inline/ML/recursive.ll
index db5b01d90bfbd..f17b85a367806 100644
--- a/llvm/test/Transforms/Inline/ML/recursive.ll
+++ b/llvm/test/Transforms/Inline/ML/recursive.ll
@@ -1,6 +1,6 @@
 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals all --version 6
-; REQUIRES: llvm_inliner_model_autogenerated || have_mlir_lowering
-; RUN: opt -S %s -o - %if have_mlir_lowering %{ -passes='inliner-ml-advisor-release' -mlgo-model=inliner %} %else %{ -passes='inliner-ml-advisor-release' %} -ml-inliner-skip-policy=if-caller-not-cold | FileCheck %s
+; REQUIRES: llvm_inliner_model_autogenerated || have_mlir_lowering_inliner
+; RUN: opt -S %s -o - %if have_mlir_lowering_inliner %{ -passes='inliner-ml-advisor-release' -mlgo-model=inliner %} %else %{ -passes='inliner-ml-advisor-release' %} -ml-inliner-skip-policy=if-caller-not-cold | FileCheck %s
 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32"
 target triple = "aarch64-unknown-linux-android29"
 
diff --git a/llvm/test/Transforms/Inline/ML/scc-dead-accounting.ll b/llvm/test/Transforms/Inline/ML/scc-dead-accounting.ll
index 897475cd6dbae..c6e6b0e5ff42c 100644
--- a/llvm/test/Transforms/Inline/ML/scc-dead-accounting.ll
+++ b/llvm/test/Transforms/Inline/ML/scc-dead-accounting.ll
@@ -9,9 +9,9 @@
 ; In this example if loop-unroll is ran after a mandatory inlining CGSCC pass,
 ; edges would increase but wouldn't be tracked
 
-; REQUIRES: llvm_inliner_model_autogenerated || have_mlir_lowering
+; REQUIRES: llvm_inliner_model_autogenerated || have_mlir_lowering_inliner
 
-; RUN: opt %if have_mlir_lowering %{ -enable-ml-inliner=release -mlgo-model=inliner %} %else %{ -enable-ml-inliner=release %} -passes=inliner-ml-advisor-release \
+; RUN: opt %if have_mlir_lowering_inliner %{ -enable-ml-inliner=release -mlgo-model=inliner %} %else %{ -enable-ml-inliner=release %} -passes=inliner-ml-advisor-release \
 ; RUN:     -keep-inline-advisor-for-printing \
 ; RUN:     -enable-scc-inline-advisor-printing -S < %s 2>&1 | FileCheck %s
 
diff --git a/llvm/test/Transforms/Inline/ML/skip-unreachable.ll b/llvm/test/Transforms/Inline/ML/skip-unreachable.ll
index 2f548edd65dd1..b10e1fcd037c2 100644
--- a/llvm/test/Transforms/Inline/ML/skip-unreachable.ll
+++ b/llvm/test/Transforms/Inline/ML/skip-unreachable.ll
@@ -1,7 +1,7 @@
 ; Test skipping inlining when the callsite is unreachable (for both mandatory
 ; and non-mandatory cases)
-; REQUIRES: llvm_inliner_model_autogenerated || have_mlir_lowering
-; RUN: opt %if have_mlir_lowering %{ -passes=inliner-ml-advisor-release -mlgo-model=inliner %} %else %{ -passes=inliner-ml-advisor-release %} -S < %s | FileCheck %s --check-prefix=CHECK
+; REQUIRES: llvm_inliner_model_autogenerated || have_mlir_lowering_inliner
+; RUN: opt %if have_mlir_lowering_inliner %{ -passes=inliner-ml-advisor-release -mlgo-model=inliner %} %else %{ -passes=inliner-ml-advisor-release %} -S < %s | FileCheck %s --check-prefix=CHECK
 
 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-grtev4-linux-gnu"
diff --git a/llvm/test/Transforms/Inline/ML/state-accounting-skip-non-cold.ll b/llvm/test/Transforms/Inline/ML/state-accounting-skip-non-cold.ll
index e75523cf90b58..6688a1b533f73 100644
--- a/llvm/test/Transforms/Inline/ML/state-accounting-skip-non-cold.ll
+++ b/llvm/test/Transforms/Inline/ML/state-accounting-skip-non-cold.ll
@@ -1,7 +1,7 @@
 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 6
-; REQUIRES: (llvm_inliner_model_autogenerated || have_mlir_lowering) && asserts
-; RUN: opt -passes='default<O3>' %if have_mlir_lowering %{ -enable-ml-inliner=release -mlgo-model=inliner %} %else %{ -enable-ml-inliner=release %} -ml-inliner-skip-policy=if-caller-not-cold -S %s -o - | FileCheck %s
-; RUN: opt -passes='default<O3>' -ml-inliner-stop-immediately %if have_mlir_lowering %{ -enable-ml-inliner=release -mlgo-model=inliner %} %else %{ -enable-ml-inliner=release %} -ml-inliner-skip-policy=if-caller-not-cold -S %s -o - | FileCheck %s
+; REQUIRES: (llvm_inliner_model_autogenerated || have_mlir_lowering_inliner) && asserts
+; RUN: opt -passes='default<O3>' %if have_mlir_lowering_inliner %{ -enable-ml-inliner=release -mlgo-model=inliner %} %else %{ -enable-ml-inliner=release %} -ml-inliner-skip-policy=if-caller-not-cold -S %s -o - | FileCheck %s
+; RUN: opt -passes='default<O3>' -ml-inliner-stop-immediately %if have_mlir_lowering_inliner %{ -enable-ml-inliner=release -mlgo-model=inliner %} %else %{ -enable-ml-inliner=release %} -ml-inliner-skip-policy=if-caller-not-cold -S %s -o - | FileCheck %s
 
 declare ptr @f()
 
diff --git a/llvm/test/Transforms/Inline/inlining-advisor-default.ll b/llvm/test/Transforms/Inline/inlining-advisor-default.ll
index 87ddc286092d4..2026121514397 100644
--- a/llvm/test/Transforms/Inline/inlining-advisor-default.ll
+++ b/llvm/test/Transforms/Inline/inlining-advisor-default.ll
@@ -4,10 +4,10 @@
 ; REQUIRES: !have_tflite
 ; RUN: not opt -passes=scc-oz-module-inliner -enable-ml-inliner=development -S < %s 2>&1 | FileCheck %s
 ; RUN: not opt -passes=scc-oz-module-inliner -enable-ml-inliner=release -S < %s 2>&1 | FileCheck %s
-; RUN: %if have_mlir_lowering %{ not opt -passes=scc-oz-module-inliner -enable-ml-inliner=release -mlgo-model=default -S < %s 2>&1 | FileCheck %s %}
-; RUN: %if have_mlir_lowering %{ not opt -passes=scc-oz-module-inliner -enable-ml-inliner=release -mlgo-model=invalid_model -S < %s 2>&1 | FileCheck %s --check-prefix=INVALID %}
+; RUN: %if have_mlir_lowering_inliner %{ not opt -passes=scc-oz-module-inliner -enable-ml-inliner=release -mlgo-model=default -S < %s 2>&1 | FileCheck %s %}
+; RUN: %if have_mlir_lowering_inliner %{ not opt -passes=scc-oz-module-inliner -enable-ml-inliner=release -mlgo-model=invalid_model -S < %s 2>&1 | FileCheck %s --check-prefix=INVALID %}
 
 declare i64 @f1()
 
 ; CHECK: Could not setup Inlining Advisor for the requested mode and/or options
-; INVALID: {{.*}}opt{{.*}}: for the --mlgo-model option: Cannot find option named 'invalid_model'!
\ No newline at end of file
+; INVALID: {{.*}}opt{{.*}}: for the --mlgo-model option: Cannot find option named 'invalid_model'!
diff --git a/llvm/test/lit.cfg.py b/llvm/test/lit.cfg.py
index 8b8f31bf5a68f..4333164437f39 100644
--- a/llvm/test/lit.cfg.py
+++ b/llvm/test/lit.cfg.py
@@ -587,6 +587,12 @@ def enable_ptxas(ptxas_executable):
 if getattr(config, "have_mlir_lowering", False):
     config.available_features.add("have_mlir_lowering")
 
+if getattr(config, "have_mlir_lowering_inliner", False):
+    config.available_features.add("have_mlir_lowering_inliner")
+
+if getattr(config, "have_mlir_lowering_regalloc", False):
+    config.available_features.add("have_mlir_lowering_regalloc")
+
 if getattr(config, "have_opencsd", False):
     config.available_features.add("opencsd")
 
diff --git a/llvm/test/lit.site.cfg.py.in b/llvm/test/lit.site.cfg.py.in
index eb9934f85ad42..03fc5b0edd747 100644
--- a/llvm/test/lit.site.cfg.py.in
+++ b/llvm/test/lit.site.cfg.py.in
@@ -58,6 +58,8 @@ config.linked_bye_extension = @LLVM_BYE_LINK_INTO_TOOLS@
 config.linked_exampleirtransforms_extension = @LLVM_EXAMPLEIRTRANSFORMS_LINK_INTO_TOOLS@
 config.have_tf_aot = @LLVM_HAVE_TF_AOT@
 config.have_mlir_lowering = @LLVM_HAVE_MLIR_LOWERING@
+config.have_mlir_lowering_inliner = @LLVM_HAVE_MLIR_LOWERING_INLINER@
+config.have_mlir_lowering_regalloc = @LLVM_HAVE_MLIR_LOWERING_REGALLOC@
 config.have_tflite = @LLVM_HAVE_TFLITE@
 config.enable_profcheck = @LLVM_ENABLE_PROFCHECK@
 config.llvm_inliner_model_autogenerated = @LLVM_INLINER_MODEL_AUTOGENERATED@
diff --git a/llvm/utils/gn/secondary/llvm/test/BUILD.gn b/llvm/utils/gn/secondary/llvm/test/BUILD.gn
index 44b08e7f10770..28242ed04c4b8 100644
--- a/llvm/utils/gn/secondary/llvm/test/BUILD.gn
+++ b/llvm/utils/gn/secondary/llvm/test/BUILD.gn
@@ -100,7 +100,8 @@ write_lit_config("lit_site_cfg") {
     "OCAMLFLAGS=",
     "LLVM_INCLUDE_EXAMPLES=0",
     "LLVM_HAVE_OPENCSD=0",
-    "LLVM_HAVE_MLIR_LOWERING=0",
+    "LLVM_HAVE_MLIR_LOWERING_INLINER=0",
+    "LLVM_HAVE_MLIR_LOWERING_REGALLOC=0",
     "LLVM_HAVE_TF_AOT=0",
     "LLVM_HAVE_TFLITE=0",
     "LLVM_INLINER_MODEL_AUTOGENERATED=0",

``````````

</details>


https://github.com/llvm/llvm-project/pull/217906


More information about the llvm-commits mailing list