summaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Vectorize
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@outlook.com>2025-11-14 15:21:49 -0800
committerAlexey Bataev <a.bataev@outlook.com>2025-11-14 15:22:55 -0800
commite8cc0d22073fd5f59e0b9e1f940dc7a9d4e82218 (patch)
tree5099834690dae887d44f9803ab0ed5a737200eab /llvm/lib/Transforms/Vectorize
parent459a64b9045481cce345e2ec7812bfc8c50e4a44 (diff)
Revert "[SLP]Check if the copyable element is a sub instruciton with abs in isCommutable"
This reverts commit ddf5bb0a2e2d2dd77bce66173387d62ab7174d9f to fix buildbots https://lab.llvm.org/buildbot/#/builders/11/builds/28083.
Diffstat (limited to 'llvm/lib/Transforms/Vectorize')
-rw-r--r--llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
index 938eacde7548..e61eb0fcfe49 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -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))
@@ -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(),
@@ -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 &&
@@ -3166,8 +3164,7 @@ public:
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);