[llvm] e82abde - [SLP][NFC] Refactor `if`s into `&&` (#156278)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 1 00:45:29 PDT 2025
Author: Piotr Fusik
Date: 2025-09-01T09:45:25+02:00
New Revision: e82abde49454d0bd2c2d37b6209e1d21fbcbaa56
URL: https://github.com/llvm/llvm-project/commit/e82abde49454d0bd2c2d37b6209e1d21fbcbaa56
DIFF: https://github.com/llvm/llvm-project/commit/e82abde49454d0bd2c2d37b6209e1d21fbcbaa56.diff
LOG: [SLP][NFC] Refactor `if`s into `&&` (#156278)
Added:
Modified:
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
index 4d4f34a0bdd38..3a81d1d24e16c 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -967,9 +967,7 @@ class BinOpSameOpcodeHelper {
return false;
}
bool equal(unsigned Opcode) {
- if (Opcode == I->getOpcode())
- return trySet(MainOpBIT, MainOpBIT);
- return false;
+ return Opcode == I->getOpcode() && trySet(MainOpBIT, MainOpBIT);
}
unsigned getOpcode() const {
MaskType Candidate = Mask & SeenBefore;
@@ -24179,9 +24177,7 @@ class HorizontalReduction {
// previous vectorization attempts.
if (any_of(VL, [&V](Value *RedVal) {
auto *RedValI = dyn_cast<Instruction>(RedVal);
- if (!RedValI)
- return false;
- return V.isDeleted(RedValI);
+ return RedValI && V.isDeleted(RedValI);
}))
break;
V.buildTree(VL, IgnoreList);
More information about the llvm-commits
mailing list