[llvm] [VPlan] Make m_False and m_True matchers stateless. NFC (PR #221581)

via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 6 08:19:59 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-transforms

Author: Luke Lau (lukel97)

<details>
<summary>Changes</summary>

is_zero_int and is_one avoid storage unlike is_specific_int, and allow the match function to be an inlined isZero/isOne call instead of APInt::isSameValue.

Improves compile time: https://llvm-compile-time-tracker.com/compare.php?from=8f7d3ba08f14c3d54b8b407d1758dbd1da01bb38&to=c766163e82ec7a377efc7a26ef1e6db38e0dec1d&stat=instructions:u


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


1 Files Affected:

- (modified) llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h (+4-8) 


``````````diff
diff --git a/llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h b/llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h
index 702766f63c050..df49dbb3c2289 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h
+++ b/llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h
@@ -113,14 +113,6 @@ inline specific_intval<0> m_SpecificSInt(int64_t V) {
       is_specific_int(APInt(64, V, /*isSigned=*/true), /*IsSigned=*/true));
 }
 
-inline specific_intval<1> m_False() {
-  return specific_intval<1>(is_specific_int(APInt(64, 0)));
-}
-
-inline specific_intval<1> m_True() {
-  return specific_intval<1>(is_specific_int(APInt(64, 1)));
-}
-
 struct is_all_ones {
   bool isValue(const APInt &C) const { return C.isAllOnes(); }
 };
@@ -149,6 +141,10 @@ inline int_pred_ty<is_zero_int> m_ZeroInt() {
 /// For vectors, this includes constants with undefined elements.
 inline int_pred_ty<is_one> m_One() { return int_pred_ty<is_one>(); }
 
+inline int_pred_ty<is_zero_int, 1> m_False() { return {}; }
+
+inline int_pred_ty<is_one, 1> m_True() { return {}; }
+
 struct bind_apint {
   const APInt *&Res;
 

``````````

</details>


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


More information about the llvm-commits mailing list