21
21
#include < optional>
22
22
23
23
using namespace llvm ;
24
+ using namespace llvm ::PatternMatch;
24
25
25
26
#define DEBUG_TYPE " x86tti"
26
27
@@ -44,8 +45,7 @@ static Value *getBoolVecFromMask(Value *Mask, const DataLayout &DL) {
44
45
45
46
// Mask was extended from a boolean vector.
46
47
Value *ExtMask;
47
- if (PatternMatch::match (
48
- Mask, PatternMatch::m_SExt (PatternMatch::m_Value (ExtMask))) &&
48
+ if (match (Mask, m_SExt (m_Value (ExtMask))) &&
49
49
ExtMask->getType ()->isIntOrIntVectorTy (1 ))
50
50
return ExtMask;
51
51
@@ -523,10 +523,10 @@ static Value *simplifyX86pmulh(IntrinsicInst &II,
523
523
524
524
// Multiply by one.
525
525
if (!IsRounding) {
526
- if (match (Arg0, PatternMatch:: m_One ()))
526
+ if (match (Arg0, m_One ()))
527
527
return IsSigned ? Builder.CreateAShr (Arg1, 15 )
528
528
: ConstantAggregateZero::get (ResTy);
529
- if (match (Arg1, PatternMatch:: m_One ()))
529
+ if (match (Arg1, m_One ()))
530
530
return IsSigned ? Builder.CreateAShr (Arg0, 15 )
531
531
: ConstantAggregateZero::get (ResTy);
532
532
}
@@ -655,7 +655,7 @@ static Value *simplifyX86addcarry(const IntrinsicInst &II,
655
655
" Unexpected types for x86 addcarry" );
656
656
657
657
// If carry-in is zero, this is just an unsigned add with overflow.
658
- if (match (CarryIn, PatternMatch:: m_ZeroInt ())) {
658
+ if (match (CarryIn, m_ZeroInt ())) {
659
659
Value *UAdd = Builder.CreateIntrinsic (Intrinsic::uadd_with_overflow, OpTy,
660
660
{Op1, Op2});
661
661
// The types have to be adjusted to match the x86 call types.
@@ -699,9 +699,9 @@ static Value *simplifyTernarylogic(const IntrinsicInst &II,
699
699
auto Xnor = [&](auto Lhs, auto Rhs) { return Not (Xor (Lhs, Rhs)); };
700
700
auto Nand = [&](auto Lhs, auto Rhs) { return Not (And (Lhs, Rhs)); };
701
701
702
- bool AIsConst = match (ArgA, PatternMatch:: m_ImmConstant ());
703
- bool BIsConst = match (ArgB, PatternMatch:: m_ImmConstant ());
704
- bool CIsConst = match (ArgC, PatternMatch:: m_ImmConstant ());
702
+ bool AIsConst = match (ArgA, m_ImmConstant ());
703
+ bool BIsConst = match (ArgB, m_ImmConstant ());
704
+ bool CIsConst = match (ArgC, m_ImmConstant ());
705
705
706
706
bool ABIsConst = AIsConst && BIsConst;
707
707
bool ACIsConst = AIsConst && CIsConst;
@@ -2887,9 +2887,8 @@ X86TTIImpl::instCombineIntrinsic(InstCombiner &IC, IntrinsicInst &II) const {
2887
2887
// intrinsics.
2888
2888
Value *MaskSrc = nullptr ;
2889
2889
ArrayRef<int > ShuffleMask;
2890
- if (match (Mask, PatternMatch::m_OneUse (PatternMatch::m_Shuffle (
2891
- PatternMatch::m_Value (MaskSrc), PatternMatch::m_Undef (),
2892
- PatternMatch::m_Mask (ShuffleMask))))) {
2890
+ if (match (Mask, m_OneUse (m_Shuffle (m_Value (MaskSrc), m_Undef (),
2891
+ m_Mask (ShuffleMask))))) {
2893
2892
// Bail if the shuffle was irregular or contains undefs.
2894
2893
int NumElts = cast<FixedVectorType>(MaskSrc->getType ())->getNumElements ();
2895
2894
if (NumElts < (int )ShuffleMask.size () || !isPowerOf2_32 (NumElts) ||
@@ -2903,7 +2902,7 @@ X86TTIImpl::instCombineIntrinsic(InstCombiner &IC, IntrinsicInst &II) const {
2903
2902
// vector condition value.
2904
2903
Value *BoolVec;
2905
2904
Mask = InstCombiner::peekThroughBitcast (Mask);
2906
- if (match (Mask, PatternMatch:: m_SExt (PatternMatch:: m_Value (BoolVec))) &&
2905
+ if (match (Mask, m_SExt (m_Value (BoolVec))) &&
2907
2906
BoolVec->getType ()->isVectorTy () &&
2908
2907
BoolVec->getType ()->getScalarSizeInBits () == 1 ) {
2909
2908
auto *MaskTy = cast<FixedVectorType>(Mask->getType ());
0 commit comments