[llvm] [VPlan] Add initial pattern match implementation for VPInstruction. (PR #80563)

via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 25 10:38:23 PST 2024


================
@@ -552,11 +554,9 @@ static bool hasConditionalTerminator(const VPBasicBlock *VPBB) {
   }
 
   const VPRecipeBase *R = &VPBB->back();
-  auto *VPI = dyn_cast<VPInstruction>(R);
-  bool IsCondBranch =
-      isa<VPBranchOnMaskRecipe>(R) ||
-      (VPI && (VPI->getOpcode() == VPInstruction::BranchOnCond ||
-               VPI->getOpcode() == VPInstruction::BranchOnCount));
+  bool IsCondBranch = isa<VPBranchOnMaskRecipe>(R) ||
+                      match(R, m_BranchOnCond(m_VPValue())) ||
+                      match(R, m_BranchOnCount(m_VPValue(), m_VPValue()));
----------------
ayalz wrote:

nit (unrelated to this patch): would be good to match for debug asserts only under #ifndef, rather than always with the (void) appeasement.

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


More information about the llvm-commits mailing list