[llvm] [DAG] Implement SDPatternMatch `m_SpecificScalarVT` and `m_SpecificVectorElementVT` matchers (PR #144996)

via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 20 01:40:40 PDT 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff HEAD~1 HEAD --extensions h,cpp -- llvm/include/llvm/CodeGen/SDPatternMatch.h llvm/unittests/CodeGen/SelectionDAGPatternMatchTest.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/include/llvm/CodeGen/SDPatternMatch.h b/llvm/include/llvm/CodeGen/SDPatternMatch.h
index 5b3682352..3c0a54bea 100644
--- a/llvm/include/llvm/CodeGen/SDPatternMatch.h
+++ b/llvm/include/llvm/CodeGen/SDPatternMatch.h
@@ -280,26 +280,31 @@ inline auto m_OtherVT() { return m_SpecificVT(MVT::Other); }
 /// Match a scalar ValueType.
 template <typename Pattern>
 inline auto m_SpecificScalarVT(EVT RefVT, const Pattern &P) {
-  return ValueType_match{[=](EVT VT) { return VT.getScalarType() == RefVT; }, P};
+  return ValueType_match{[=](EVT VT) { return VT.getScalarType() == RefVT; },
+                         P};
 }
 inline auto m_SpecificScalarVT(EVT RefVT) {
-  return ValueType_match{[=](EVT VT) { return VT.getScalarType() == RefVT; }, m_Value()};
+  return ValueType_match{[=](EVT VT) { return VT.getScalarType() == RefVT; },
+                         m_Value()};
 }
 
 /// Match a vector ValueType.
 template <typename Pattern>
 inline auto m_SpecificVectorElementVT(EVT RefVT, const Pattern &P) {
-  return ValueType_match{
-      [=](EVT VT) { return VT.isVector() && VT.getVectorElementType() == RefVT; },
-      P};
+  return ValueType_match{[=](EVT VT) {
+                           return VT.isVector() &&
+                                  VT.getVectorElementType() == RefVT;
+                         },
+                         P};
 }
 inline auto m_SpecificVectorElementVT(EVT RefVT) {
-  return ValueType_match{
-      [=](EVT VT) { return VT.isVector() && VT.getVectorElementType() == RefVT; },
-      m_Value()};
+  return ValueType_match{[=](EVT VT) {
+                           return VT.isVector() &&
+                                  VT.getVectorElementType() == RefVT;
+                         },
+                         m_Value()};
 }
 
-
 /// Match any integer ValueTypes.
 template <typename Pattern> inline auto m_IntegerVT(const Pattern &P) {
   return ValueType_match{[](EVT VT) { return VT.isInteger(); }, P};

``````````

</details>


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


More information about the llvm-commits mailing list