@@ -705,6 +705,7 @@ struct bind_const_intval_ty {
705
705
706
706
// / Match a specified integer value or vector of all elements of that
707
707
// / value.
708
+ template <bool AllowUndefs>
708
709
struct specific_intval {
709
710
APInt Val;
710
711
@@ -714,22 +715,30 @@ struct specific_intval {
714
715
const auto *CI = dyn_cast<ConstantInt>(V);
715
716
if (!CI && V->getType ()->isVectorTy ())
716
717
if (const auto *C = dyn_cast<Constant>(V))
717
- CI = dyn_cast_or_null<ConstantInt>(C->getSplatValue ());
718
+ CI = dyn_cast_or_null<ConstantInt>(C->getSplatValue (AllowUndefs ));
718
719
719
720
return CI && APInt::isSameValue (CI->getValue (), Val);
720
721
}
721
722
};
722
723
723
724
// / Match a specific integer value or vector with all elements equal to
724
725
// / the value.
725
- inline specific_intval m_SpecificInt (APInt V) {
726
- return specific_intval (std::move (V));
726
+ inline specific_intval< false > m_SpecificInt (APInt V) {
727
+ return specific_intval< false > (std::move (V));
727
728
}
728
729
729
- inline specific_intval m_SpecificInt (uint64_t V) {
730
+ inline specific_intval< false > m_SpecificInt (uint64_t V) {
730
731
return m_SpecificInt (APInt (64 , V));
731
732
}
732
733
734
+ inline specific_intval<true > m_SpecificIntAllowUndef (APInt V) {
735
+ return specific_intval<true >(std::move (V));
736
+ }
737
+
738
+ inline specific_intval<true > m_SpecificIntAllowUndef (uint64_t V) {
739
+ return m_SpecificIntAllowUndef (APInt (64 , V));
740
+ }
741
+
733
742
// / Match a ConstantInt and bind to its value. This does not match
734
743
// / ConstantInts wider than 64-bits.
735
744
inline bind_const_intval_ty m_ConstantInt (uint64_t &V) { return V; }
0 commit comments