[llvm] [VPlanPatternMatch] Introduce m_ConstantInt (PR #159558)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 18 07:18:50 PDT 2025


================
@@ -176,6 +176,50 @@ 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>(); }
 
+struct apint_match {
+  const APInt *&Res;
+
+  apint_match(const APInt *&Res) : Res(Res) {}
+
+  bool match(VPValue *VPV) const {
+    if (!VPV->isLiveIn())
+      return false;
+    Value *V = VPV->getLiveInIRValue();
+    if (!V)
+      return false;
+    const auto *CI = dyn_cast<ConstantInt>(V);
+    if (!CI && V->getType()->isVectorTy())
----------------
fhahn wrote:

Can this actually happen?

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


More information about the llvm-commits mailing list