Skip to content

Commit 2bc474b

Browse files
committed
[InstCombine][X86] Pull out repeated uses of PatternMatch namespace. NFC.
Followup requested on #96882
1 parent 18b575d commit 2bc474b

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

llvm/lib/Target/X86/X86InstCombineIntrinsic.cpp

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include <optional>
2222

2323
using namespace llvm;
24+
using namespace llvm::PatternMatch;
2425

2526
#define DEBUG_TYPE "x86tti"
2627

@@ -44,8 +45,7 @@ static Value *getBoolVecFromMask(Value *Mask, const DataLayout &DL) {
4445

4546
// Mask was extended from a boolean vector.
4647
Value *ExtMask;
47-
if (PatternMatch::match(
48-
Mask, PatternMatch::m_SExt(PatternMatch::m_Value(ExtMask))) &&
48+
if (match(Mask, m_SExt(m_Value(ExtMask))) &&
4949
ExtMask->getType()->isIntOrIntVectorTy(1))
5050
return ExtMask;
5151

@@ -523,10 +523,10 @@ static Value *simplifyX86pmulh(IntrinsicInst &II,
523523

524524
// Multiply by one.
525525
if (!IsRounding) {
526-
if (match(Arg0, PatternMatch::m_One()))
526+
if (match(Arg0, m_One()))
527527
return IsSigned ? Builder.CreateAShr(Arg1, 15)
528528
: ConstantAggregateZero::get(ResTy);
529-
if (match(Arg1, PatternMatch::m_One()))
529+
if (match(Arg1, m_One()))
530530
return IsSigned ? Builder.CreateAShr(Arg0, 15)
531531
: ConstantAggregateZero::get(ResTy);
532532
}
@@ -655,7 +655,7 @@ static Value *simplifyX86addcarry(const IntrinsicInst &II,
655655
"Unexpected types for x86 addcarry");
656656

657657
// 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())) {
659659
Value *UAdd = Builder.CreateIntrinsic(Intrinsic::uadd_with_overflow, OpTy,
660660
{Op1, Op2});
661661
// The types have to be adjusted to match the x86 call types.
@@ -699,9 +699,9 @@ static Value *simplifyTernarylogic(const IntrinsicInst &II,
699699
auto Xnor = [&](auto Lhs, auto Rhs) { return Not(Xor(Lhs, Rhs)); };
700700
auto Nand = [&](auto Lhs, auto Rhs) { return Not(And(Lhs, Rhs)); };
701701

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());
705705

706706
bool ABIsConst = AIsConst && BIsConst;
707707
bool ACIsConst = AIsConst && CIsConst;
@@ -2887,9 +2887,8 @@ X86TTIImpl::instCombineIntrinsic(InstCombiner &IC, IntrinsicInst &II) const {
28872887
// intrinsics.
28882888
Value *MaskSrc = nullptr;
28892889
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))))) {
28932892
// Bail if the shuffle was irregular or contains undefs.
28942893
int NumElts = cast<FixedVectorType>(MaskSrc->getType())->getNumElements();
28952894
if (NumElts < (int)ShuffleMask.size() || !isPowerOf2_32(NumElts) ||
@@ -2903,7 +2902,7 @@ X86TTIImpl::instCombineIntrinsic(InstCombiner &IC, IntrinsicInst &II) const {
29032902
// vector condition value.
29042903
Value *BoolVec;
29052904
Mask = InstCombiner::peekThroughBitcast(Mask);
2906-
if (match(Mask, PatternMatch::m_SExt(PatternMatch::m_Value(BoolVec))) &&
2905+
if (match(Mask, m_SExt(m_Value(BoolVec))) &&
29072906
BoolVec->getType()->isVectorTy() &&
29082907
BoolVec->getType()->getScalarSizeInBits() == 1) {
29092908
auto *MaskTy = cast<FixedVectorType>(Mask->getType());

0 commit comments

Comments
 (0)