[llvm] d76d639 - [profcheck] Change the FileCheck substitute command (#156985)

via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 5 10:18:35 PDT 2025


Author: Alan Zhao
Date: 2025-09-05T10:18:31-07:00
New Revision: d76d6392ea9a3fe5b35e4d3b8e0614a32e7fcbd7

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

LOG: [profcheck] Change the FileCheck substitute command (#156985)

The intent of the original regex doesn't work if, for example, the last
RUN line was a pipe and FileCheck is in the next RUN line. See for
example

[`function-specialization3.ll`](https://github.com/llvm/llvm-project/blob/a7c2ce6009a8034ebbf718c12a6e56c085036b57/llvm/test/Transforms/FunctionSpecialization/function-specialization3.ll).
To fix this we just replace the redirerect stdout to `/dev/null` with
`cat > /dev/null`, which works because it's effectively a no-op command
that can be piped to or run standalone.

Tracking issue: #147390

Added: 
    

Modified: 
    llvm/test/lit.cfg.py

Removed: 
    


################################################################################
diff  --git a/llvm/test/lit.cfg.py b/llvm/test/lit.cfg.py
index 05b5f02b9bd9a..867a44be56727 100644
--- a/llvm/test/lit.cfg.py
+++ b/llvm/test/lit.cfg.py
@@ -20,8 +20,8 @@
 # testFormat: The test format to use to interpret tests.
 extra_substitutions = extra_substitutions = (
     [
-        (r"\| not FileCheck .*", "> /dev/null"),
-        (r"\| FileCheck .*", "> /dev/null"),
+        (r"FileCheck .*", "cat > /dev/null"),
+        (r"not FileCheck .*", "cat > /dev/null"),
     ]
     if config.enable_profcheck
     else []
@@ -39,6 +39,16 @@
 # directories.
 config.excludes = ["Inputs", "CMakeLists.txt", "README.txt", "LICENSE.txt"]
 
+# Exclude llvm-reduce tests for profcheck because we substitute the FileCheck
+# binary with a no-op command for profcheck, but llvm-reduce tests have RUN
+# commands of the form llvm-reduce --test FileCheck, which explode if we
+# substitute FileCheck because llvm-reduce expects FileCheck in these tests.
+# It's not really possible to exclude these tests from the command substitution,
+# so we just exclude llvm-reduce tests from this config altogether. This should
+# be fine though as profcheck config tests are mostly concerned with opt.
+if config.enable_profcheck:
+    config.excludes = config.excludes + ["llvm-reduce"]
+
 # test_source_root: The root path where tests are located.
 config.test_source_root = os.path.dirname(__file__)
 


        


More information about the llvm-commits mailing list