Skip to content

Commit de53aae

Browse files
committed
Improve checks
1 parent c17adab commit de53aae

File tree

1 file changed

+4
-15
lines changed

1 file changed

+4
-15
lines changed

llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1496,13 +1496,8 @@ static bool isAllActivePredicate(Value *Pred) {
14961496
m_ConstantInt<AArch64SVEPredPattern::all>())))
14971497
return true;
14981498

1499-
if (Value *Splat = getSplatValue(Pred)) {
1500-
auto ConstIdx = dyn_cast<ConstantInt>(Splat);
1501-
if (ConstIdx->getZExtValue() == 1)
1502-
return true;
1503-
}
1504-
1505-
return false;
1499+
auto *C = dyn_cast<Constant>(Pred);
1500+
return (C && C->isAllOnesValue());
15061501
}
15071502

15081503
// Use SVE intrinsic info to eliminate redundant operands and/or canonicalise
@@ -2643,14 +2638,8 @@ static std::optional<Instruction *> instCombineDMB(InstCombiner &IC,
26432638

26442639
static std::optional<Instruction *> instCombinePTrue(InstCombiner &IC,
26452640
IntrinsicInst &II) {
2646-
IRBuilder<> Builder(&II);
2647-
auto Type = cast<VectorType>(II.getType());
2648-
ConstantInt *Pattern;
2649-
if (match(II.getOperand(0), m_ConstantInt(Pattern)) &&
2650-
Pattern->getZExtValue() == AArch64SVEPredPattern::all) {
2651-
Value *One = ConstantInt::get(Builder.getInt1Ty(), APInt(1, 1));
2652-
Value *SplatOne = Builder.CreateVectorSplat(Type->getElementCount(), One);
2653-
return IC.replaceInstUsesWith(II, SplatOne);
2641+
if (match(II.getOperand(0), m_ConstantInt<AArch64SVEPredPattern::all>())) {
2642+
return IC.replaceInstUsesWith(II, Constant::getAllOnesValue(II.getType()));
26542643
}
26552644
return std::nullopt;
26562645
}

0 commit comments

Comments
 (0)