[llvm] 806dea4 - [SLP] Cleanup: Remove `tryToVectorizePair()`, most probably NFC
Vasileios Porpodas via llvm-commits
llvm-commits at lists.llvm.org
Fri May 19 20:26:09 PDT 2023
Author: Vasileios Porpodas
Date: 2023-05-19T20:25:20-07:00
New Revision: 806dea46be4c49dc587b98dab5e4d9d242a6abdb
URL: https://github.com/llvm/llvm-project/commit/806dea46be4c49dc587b98dab5e4d9d242a6abdb
DIFF: https://github.com/llvm/llvm-project/commit/806dea46be4c49dc587b98dab5e4d9d242a6abdb.diff
LOG: [SLP] Cleanup: Remove `tryToVectorizePair()`, most probably NFC
`tryToVectorizePair()` adds a level of indirection over `tryToVectorizeList()`.
I am not really sure why it is needed, it looks redundant.
I replaced all calls to `tryToVectorizePair()` with calls to
`tryToVectorizeList()` and I am not seeing any failures.
Differential Revision: https://reviews.llvm.org/D151004
Added:
Modified:
llvm/include/llvm/Transforms/Vectorize/SLPVectorizer.h
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/Transforms/Vectorize/SLPVectorizer.h b/llvm/include/llvm/Transforms/Vectorize/SLPVectorizer.h
index 87fdb8b26382a..737bb8525051a 100644
--- a/llvm/include/llvm/Transforms/Vectorize/SLPVectorizer.h
+++ b/llvm/include/llvm/Transforms/Vectorize/SLPVectorizer.h
@@ -91,9 +91,6 @@ struct SLPVectorizerPass : public PassInfoMixin<SLPVectorizerPass> {
/// every time we run into a memory barrier.
void collectSeedInstructions(BasicBlock *BB);
- /// Try to vectorize a chain that starts at two arithmetic instrs.
- bool tryToVectorizePair(Value *A, Value *B, slpvectorizer::BoUpSLP &R);
-
/// Try to vectorize a list of operands.
/// \param MaxVFOnly Vectorize only using maximal allowed register size.
/// \returns true if a value was vectorized.
diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
index 0569255b9afe8..a1079d44114d7 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -12418,15 +12418,6 @@ void SLPVectorizerPass::collectSeedInstructions(BasicBlock *BB) {
}
}
-bool SLPVectorizerPass::tryToVectorizePair(Value *A, Value *B, BoUpSLP &R) {
- if (!A || !B)
- return false;
- if (isa<InsertElementInst>(A) || isa<InsertElementInst>(B))
- return false;
- Value *VL[] = {A, B};
- return tryToVectorizeList(VL, R);
-}
-
bool SLPVectorizerPass::tryToVectorizeList(ArrayRef<Value *> VL, BoUpSLP &R,
bool MaxVFOnly) {
if (VL.size() < 2)
@@ -12602,14 +12593,14 @@ bool SLPVectorizerPass::tryToVectorize(Instruction *I, BoUpSLP &R) {
}
if (Candidates.size() == 1)
- return tryToVectorizePair(Op0, Op1, R);
+ return tryToVectorizeList({Op0, Op1}, R);
// We have multiple options. Try to pick the single best.
std::optional<int> BestCandidate = R.findBestRootPair(Candidates);
if (!BestCandidate)
return false;
- return tryToVectorizePair(Candidates[*BestCandidate].first,
- Candidates[*BestCandidate].second, R);
+ return tryToVectorizeList(
+ {Candidates[*BestCandidate].first, Candidates[*BestCandidate].second}, R);
}
namespace {
More information about the llvm-commits
mailing list