Skip to content

Commit a5884f0

Browse files
committed
[InstCombine] Replace m_SpecificInt(1) with m_One()
1 parent 52220c2 commit a5884f0

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

llvm/include/llvm/IR/PatternMatch.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2927,7 +2927,7 @@ struct VScaleVal_match {
29272927
if (GEP->getNumIndices() == 1 && DerefTy &&
29282928
DerefTy->getElementType()->isIntegerTy(8) &&
29292929
m_Zero().match(GEP->getPointerOperand()) &&
2930-
m_SpecificInt(1).match(GEP->idx_begin()->get()))
2930+
m_One().match(GEP->idx_begin()->get()))
29312931
return true;
29322932
}
29332933
}

llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1882,8 +1882,8 @@ instCombineLD1GatherIndex(InstCombiner &IC, IntrinsicInst &II) {
18821882
// (sve.ld1.gather.index Mask BasePtr (sve.index IndexBase 1))
18831883
// => (masked.load (gep BasePtr IndexBase) Align Mask zeroinitializer)
18841884
Value *IndexBase;
1885-
if (match(Index, m_Intrinsic<Intrinsic::aarch64_sve_index>(
1886-
m_Value(IndexBase), m_SpecificInt(1)))) {
1885+
if (match(Index, m_Intrinsic<Intrinsic::aarch64_sve_index>(m_Value(IndexBase),
1886+
m_One()))) {
18871887
Align Alignment =
18881888
BasePtr->getPointerAlignment(II.getDataLayout());
18891889

@@ -1912,8 +1912,8 @@ instCombineST1ScatterIndex(InstCombiner &IC, IntrinsicInst &II) {
19121912
// (sve.st1.scatter.index Value Mask BasePtr (sve.index IndexBase 1))
19131913
// => (masked.store Value (gep BasePtr IndexBase) Align Mask)
19141914
Value *IndexBase;
1915-
if (match(Index, m_Intrinsic<Intrinsic::aarch64_sve_index>(
1916-
m_Value(IndexBase), m_SpecificInt(1)))) {
1915+
if (match(Index, m_Intrinsic<Intrinsic::aarch64_sve_index>(m_Value(IndexBase),
1916+
m_One()))) {
19171917
Align Alignment =
19181918
BasePtr->getPointerAlignment(II.getDataLayout());
19191919

@@ -2508,7 +2508,7 @@ bool AArch64TTIImpl::isExtPartOfAvgExpr(const Instruction *ExtUser, Type *Dst,
25082508
// m_ZExtOrSExt matched.
25092509
Instruction *Ex1, *Ex2;
25102510
if (!(match(Add, m_c_Add(m_Instruction(Ex1),
2511-
m_c_Add(m_Instruction(Ex2), m_SpecificInt(1))))))
2511+
m_c_Add(m_Instruction(Ex2), m_One())))))
25122512
return false;
25132513

25142514
// Ensure both extends are of the same type

llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ static bool tryToRecognizePopCount(Instruction &I) {
327327
Value *Root, *SubOp1;
328328
// Matching "i - ((i >> 1) & 0x55555555...)".
329329
if (match(AndOp0, m_Sub(m_Value(Root), m_Value(SubOp1))) &&
330-
match(SubOp1, m_And(m_LShr(m_Specific(Root), m_SpecificInt(1)),
330+
match(SubOp1, m_And(m_LShr(m_Specific(Root), m_One()),
331331
m_SpecificInt(Mask55)))) {
332332
LLVM_DEBUG(dbgs() << "Recognized popcount intrinsic\n");
333333
IRBuilder<> Builder(&I);

llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -930,7 +930,7 @@ static Value *foldIsPowerOf2OrZero(ICmpInst *Cmp0, ICmpInst *Cmp1, bool IsAnd,
930930
CmpInst::Predicate Pred0, Pred1;
931931
Value *X;
932932
if (!match(Cmp0, m_ICmp(Pred0, m_Intrinsic<Intrinsic::ctpop>(m_Value(X)),
933-
m_SpecificInt(1))) ||
933+
m_One())) ||
934934
!match(Cmp1, m_ICmp(Pred1, m_Specific(X), m_ZeroInt())))
935935
return nullptr;
936936

@@ -968,7 +968,7 @@ static Value *foldIsPowerOf2(ICmpInst *Cmp0, ICmpInst *Cmp1, bool JoinedByAnd,
968968
match(Cmp0, m_SpecificICmp(ICmpInst::ICMP_EQ, m_Value(X), m_ZeroInt())) &&
969969
match(Cmp1, m_SpecificICmp(ICmpInst::ICMP_UGT,
970970
m_Intrinsic<Intrinsic::ctpop>(m_Specific(X)),
971-
m_SpecificInt(1)))) {
971+
m_One()))) {
972972
Value *CtPop = Cmp1->getOperand(0);
973973
return Builder.CreateICmpNE(CtPop, ConstantInt::get(CtPop->getType(), 1));
974974
}

llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1359,7 +1359,7 @@ class LowerMatrixIntrinsics {
13591359
m_Load(m_Value()),
13601360
m_CombineOr(m_Intrinsic<Intrinsic::matrix_transpose>(),
13611361
m_Intrinsic<Intrinsic::matrix_column_major_load>(
1362-
m_Value(), m_SpecificInt(1))))));
1362+
m_Value(), m_One())))));
13631363
};
13641364
// Returns the cost benefit of using \p Op with the dot product lowering. If
13651365
// the returned cost is < 0, the argument is cheaper to use in the

0 commit comments

Comments
 (0)