@@ -260,10 +260,9 @@ struct Recipe_match {
260260 static bool matchRecipeAndOpcode (const VPRecipeBase *R) {
261261 auto *DefR = dyn_cast<RecipeTy>(R);
262262 // Check for recipes that do not have opcodes.
263- if constexpr (std::is_same<RecipeTy, VPScalarIVStepsRecipe>::value ||
264- std::is_same<RecipeTy, VPCanonicalIVPHIRecipe>::value ||
265- std::is_same<RecipeTy, VPDerivedIVRecipe>::value ||
266- std::is_same<RecipeTy, VPWidenGEPRecipe>::value)
263+ if constexpr (std::is_same_v<RecipeTy, VPScalarIVStepsRecipe> ||
264+ std::is_same_v<RecipeTy, VPCanonicalIVPHIRecipe> ||
265+ std::is_same_v<RecipeTy, VPDerivedIVRecipe>)
267266 return DefR;
268267 else
269268 return DefR && DefR->getOpcode () == Opcode;
@@ -532,15 +531,24 @@ m_SpecificCmp(CmpPredicate MatchPred, const Op0_t &Op0, const Op1_t &Op1) {
532531}
533532
534533template <typename Op0_t, typename Op1_t>
535- using GEPLikeRecipe_match =
534+ using GEPLikeRecipe_match = match_combine_or<
536535 Recipe_match<std::tuple<Op0_t, Op1_t>, Instruction::GetElementPtr,
537- /* Commutative*/ false , VPWidenRecipe, VPReplicateRecipe,
538- VPWidenGEPRecipe, VPInstruction>;
536+ /* Commutative*/ false , VPReplicateRecipe, VPWidenGEPRecipe>,
537+ match_combine_or<
538+ VPInstruction_match<VPInstruction::PtrAdd, Op0_t, Op1_t>,
539+ VPInstruction_match<VPInstruction::WidePtrAdd, Op0_t, Op1_t>>>;
539540
540541template <typename Op0_t, typename Op1_t>
541542inline GEPLikeRecipe_match<Op0_t, Op1_t> m_GetElementPtr (const Op0_t &Op0,
542543 const Op1_t &Op1) {
543- return GEPLikeRecipe_match<Op0_t, Op1_t>(Op0, Op1);
544+ return m_CombineOr (
545+ Recipe_match<std::tuple<Op0_t, Op1_t>, Instruction::GetElementPtr,
546+ /* Commutative*/ false , VPReplicateRecipe, VPWidenGEPRecipe>(
547+ Op0, Op1),
548+ m_CombineOr (
549+ VPInstruction_match<VPInstruction::PtrAdd, Op0_t, Op1_t>(Op0, Op1),
550+ VPInstruction_match<VPInstruction::WidePtrAdd, Op0_t, Op1_t>(Op0,
551+ Op1)));
544552}
545553
546554template <typename Op0_t, typename Op1_t, typename Op2_t>
0 commit comments