[clang] [llvm] [NFCI] [ValueTracking] Add pass to print ConstantRanges (PR #140144)
Florian Mayer via cfe-commits
cfe-commits at lists.llvm.org
Thu May 15 16:18:03 PDT 2025
https://github.com/fmayer updated https://github.com/llvm/llvm-project/pull/140144
>From 2d82539ce535f6725864815077111ead705d8ce4 Mon Sep 17 00:00:00 2001
From: Florian Mayer <fmayer at google.com>
Date: Thu, 15 May 2025 14:38:00 -0700
Subject: [PATCH 1/3] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20ch?=
=?UTF-8?q?anges=20to=20main=20this=20commit=20is=20based=20on?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Created using spr 1.3.4
[skip ci]
---
clang/include/clang/ASTMatchers/ASTMatchers.h | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/clang/include/clang/ASTMatchers/ASTMatchers.h b/clang/include/clang/ASTMatchers/ASTMatchers.h
index e6b684b24b080..255f7d3487f9d 100644
--- a/clang/include/clang/ASTMatchers/ASTMatchers.h
+++ b/clang/include/clang/ASTMatchers/ASTMatchers.h
@@ -3144,6 +3144,24 @@ extern const internal::VariadicFunction<internal::Matcher<NamedDecl>, StringRef,
internal::hasAnyNameFunc>
hasAnyName;
+/// Matches NamedDecl nodes that have any of the names in vector.
+///
+/// This is useful for matching a list of names that are only known at runtime,
+/// e.g. through a command line argument.
+///
+/// \code
+/// hasAnyName({a, b, c})
+/// \endcode
+/// is equivalent to
+/// \code
+/// anyOf(hasName(a), hasName(b), hasName(c))
+/// \endcode
+inline internal::Matcher<NamedDecl>
+hasAnyNameInVector(std::vector<std::string> Names) {
+ return internal::Matcher<NamedDecl>(
+ new internal::HasNameMatcher(std::move(Names)));
+}
+
/// Matches NamedDecl nodes whose fully qualified names contain
/// a substring matched by the given RegExp.
///
>From 6985ca7491ea8ccdb78415616e3c9babdd7cde3d Mon Sep 17 00:00:00 2001
From: Jorge Gorbe Moya <jgorbe at google.com>
Date: Thu, 15 May 2025 14:40:19 -0700
Subject: [PATCH 2/3] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20ch?=
=?UTF-8?q?anges=20introduced=20through=20rebase?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Created using spr 1.3.4
[skip ci]
---
clang/include/clang/ASTMatchers/ASTMatchers.h | 18 ------------------
1 file changed, 18 deletions(-)
diff --git a/clang/include/clang/ASTMatchers/ASTMatchers.h b/clang/include/clang/ASTMatchers/ASTMatchers.h
index 255f7d3487f9d..e6b684b24b080 100644
--- a/clang/include/clang/ASTMatchers/ASTMatchers.h
+++ b/clang/include/clang/ASTMatchers/ASTMatchers.h
@@ -3144,24 +3144,6 @@ extern const internal::VariadicFunction<internal::Matcher<NamedDecl>, StringRef,
internal::hasAnyNameFunc>
hasAnyName;
-/// Matches NamedDecl nodes that have any of the names in vector.
-///
-/// This is useful for matching a list of names that are only known at runtime,
-/// e.g. through a command line argument.
-///
-/// \code
-/// hasAnyName({a, b, c})
-/// \endcode
-/// is equivalent to
-/// \code
-/// anyOf(hasName(a), hasName(b), hasName(c))
-/// \endcode
-inline internal::Matcher<NamedDecl>
-hasAnyNameInVector(std::vector<std::string> Names) {
- return internal::Matcher<NamedDecl>(
- new internal::HasNameMatcher(std::move(Names)));
-}
-
/// Matches NamedDecl nodes whose fully qualified names contain
/// a substring matched by the given RegExp.
///
>From 6ab87b273adb1a7c1137b4328fa8698796f670bd Mon Sep 17 00:00:00 2001
From: Florian Mayer <fmayer at google.com>
Date: Thu, 15 May 2025 16:17:51 -0700
Subject: [PATCH 3/3] order
Created using spr 1.3.4
---
llvm/lib/Passes/PassRegistry.def | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/llvm/lib/Passes/PassRegistry.def b/llvm/lib/Passes/PassRegistry.def
index 8cbc6a1156c51..584488a079007 100644
--- a/llvm/lib/Passes/PassRegistry.def
+++ b/llvm/lib/Passes/PassRegistry.def
@@ -443,6 +443,7 @@ FUNCTION_PASS("print<access-info>", LoopAccessInfoPrinterPass(errs()))
FUNCTION_PASS("print<assumptions>", AssumptionPrinterPass(errs()))
FUNCTION_PASS("print<block-freq>", BlockFrequencyPrinterPass(errs()))
FUNCTION_PASS("print<branch-prob>", BranchProbabilityPrinterPass(errs()))
+FUNCTION_PASS("print<constant-range>", ConstantRangePrinterPass(errs()))
FUNCTION_PASS("print<cost-model>", CostModelPrinterPass(errs()))
FUNCTION_PASS("print<cycles>", CycleInfoPrinterPass(errs()))
FUNCTION_PASS("print<da>", DependenceAnalysisPrinterPass(errs()))
@@ -462,7 +463,6 @@ FUNCTION_PASS("print<phi-values>", PhiValuesPrinterPass(errs()))
FUNCTION_PASS("print<postdomtree>", PostDominatorTreePrinterPass(errs()))
FUNCTION_PASS("print<regions>", RegionInfoPrinterPass(errs()))
FUNCTION_PASS("print<scalar-evolution>", ScalarEvolutionPrinterPass(errs()))
-FUNCTION_PASS("print<constant-range>", ConstantRangePrinterPass(errs()))
FUNCTION_PASS("print<stack-safety-local>", StackSafetyPrinterPass(errs()))
FUNCTION_PASS("print<uniformity>", UniformityInfoPrinterPass(errs()))
FUNCTION_PASS("reassociate", ReassociatePass())
More information about the cfe-commits
mailing list