[llvm] 11b768a - [SandboxVec][BottomUpVec] Fix bug in invalidation of analyses
Vasileios Porpodas via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 5 18:02:12 PST 2024
Author: Vasileios Porpodas
Date: 2024-11-05T18:01:31-08:00
New Revision: 11b768af3ed672c18c4197bf43273b31ccc3c95e
URL: https://github.com/llvm/llvm-project/commit/11b768af3ed672c18c4197bf43273b31ccc3c95e
DIFF: https://github.com/llvm/llvm-project/commit/11b768af3ed672c18c4197bf43273b31ccc3c95e.diff
LOG: [SandboxVec][BottomUpVec] Fix bug in invalidation of analyses
This makes sure we don't preserve analyses when we modify the IR.
This was causing errors in the EXPENSIVE_CHECKS build.
Added:
Modified:
llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/Passes/BottomUpVec.h
llvm/lib/Transforms/Vectorize/SandboxVectorizer/Passes/BottomUpVec.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/Passes/BottomUpVec.h b/llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/Passes/BottomUpVec.h
index a52368b5704a17..18e34bcec81b06 100644
--- a/llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/Passes/BottomUpVec.h
+++ b/llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/Passes/BottomUpVec.h
@@ -30,7 +30,7 @@ class BottomUpVec final : public FunctionPass {
/// \p Bndl. \p Operands are the already vectorized operands.
Value *createVectorInstr(ArrayRef<Value *> Bndl, ArrayRef<Value *> Operands);
Value *vectorizeRec(ArrayRef<Value *> Bndl);
- void tryVectorize(ArrayRef<Value *> Seeds);
+ bool tryVectorize(ArrayRef<Value *> Seeds);
// The PM containing the pipeline of region passes.
RegionPassManager RPM;
diff --git a/llvm/lib/Transforms/Vectorize/SandboxVectorizer/Passes/BottomUpVec.cpp b/llvm/lib/Transforms/Vectorize/SandboxVectorizer/Passes/BottomUpVec.cpp
index 8b36ce57e2ae85..37713e7da6432d 100644
--- a/llvm/lib/Transforms/Vectorize/SandboxVectorizer/Passes/BottomUpVec.cpp
+++ b/llvm/lib/Transforms/Vectorize/SandboxVectorizer/Passes/BottomUpVec.cpp
@@ -54,6 +54,7 @@ getInsertPointAfterInstrs(ArrayRef<Value *> Instrs) {
Value *BottomUpVec::createVectorInstr(ArrayRef<Value *> Bndl,
ArrayRef<Value *> Operands) {
+ Change = true;
assert(all_of(Bndl, [](auto *V) { return isa<Instruction>(V); }) &&
"Expect Instructions!");
auto &Ctx = Bndl[0]->getContext();
@@ -194,7 +195,10 @@ Value *BottomUpVec::vectorizeRec(ArrayRef<Value *> Bndl) {
return NewVec;
}
-void BottomUpVec::tryVectorize(ArrayRef<Value *> Bndl) { vectorizeRec(Bndl); }
+bool BottomUpVec::tryVectorize(ArrayRef<Value *> Bndl) {
+ vectorizeRec(Bndl);
+ return Change;
+}
bool BottomUpVec::runOnFunction(Function &F, const Analyses &A) {
Legality = std::make_unique<LegalityAnalysis>(
@@ -208,7 +212,7 @@ bool BottomUpVec::runOnFunction(Function &F, const Analyses &A) {
// TODO: If vectorization succeeds, run the RegionPassManager on the
// resulting region.
if (Seeds.size() >= 2)
- tryVectorize(Seeds);
+ Change |= tryVectorize(Seeds);
}
return Change;
}
More information about the llvm-commits
mailing list