Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -537,8 +537,7 @@ static bool isSplat(ArrayRef<Value *> VL) {
/// \param I The instruction to check for commutativity
/// \param ValWithUses The value whose uses are analyzed for special
/// patterns
static bool isCommutative(Instruction *I, Value *ValWithUses,
bool IsCopyable = false) {
static bool isCommutative(Instruction *I, Value *ValWithUses) {
if (auto *Cmp = dyn_cast<CmpInst>(I))
return Cmp->isCommutative();
if (auto *BO = dyn_cast<BinaryOperator>(I))
Expand All @@ -547,7 +546,7 @@ static bool isCommutative(Instruction *I, Value *ValWithUses,
!ValWithUses->hasNUsesOrMore(UsesLimit) &&
all_of(
ValWithUses->uses(),
[&](const Use &U) {
[](const Use &U) {
// Commutative, if icmp eq/ne sub, 0
CmpPredicate Pred;
if (match(U.getUser(),
Expand All @@ -556,11 +555,10 @@ static bool isCommutative(Instruction *I, Value *ValWithUses,
return true;
// Commutative, if abs(sub nsw, true) or abs(sub, false).
ConstantInt *Flag;
auto *I = dyn_cast<BinaryOperator>(U.get());
return match(U.getUser(),
m_Intrinsic<Intrinsic::abs>(
m_Specific(U.get()), m_ConstantInt(Flag))) &&
((!IsCopyable && I && !I->hasNoSignedWrap()) ||
(!cast<Instruction>(U.get())->hasNoSignedWrap() ||
Flag->isOne());
})) ||
(BO->getOpcode() == Instruction::FSub &&
Expand Down Expand Up @@ -3166,8 +3164,7 @@ class BoUpSLP {
bool IsInverseOperation = false;
if (S.isCopyableElement(VL[Lane])) {
// The value is a copyable element.
IsInverseOperation =
!isCommutative(MainOp, VL[Lane], /*IsCopyable=*/true);
IsInverseOperation = !isCommutative(MainOp, VL[Lane]);
} else {
assert(I && "Expected instruction");
auto [SelectedOp, Ops] = convertTo(I, S);
Expand Down

This file was deleted.

Loading