Skip to content

Commit 11b768a

Browse files
committed
[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.
1 parent db21dbd commit 11b768a

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/Passes/BottomUpVec.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class BottomUpVec final : public FunctionPass {
3030
/// \p Bndl. \p Operands are the already vectorized operands.
3131
Value *createVectorInstr(ArrayRef<Value *> Bndl, ArrayRef<Value *> Operands);
3232
Value *vectorizeRec(ArrayRef<Value *> Bndl);
33-
void tryVectorize(ArrayRef<Value *> Seeds);
33+
bool tryVectorize(ArrayRef<Value *> Seeds);
3434

3535
// The PM containing the pipeline of region passes.
3636
RegionPassManager RPM;

llvm/lib/Transforms/Vectorize/SandboxVectorizer/Passes/BottomUpVec.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ getInsertPointAfterInstrs(ArrayRef<Value *> Instrs) {
5454

5555
Value *BottomUpVec::createVectorInstr(ArrayRef<Value *> Bndl,
5656
ArrayRef<Value *> Operands) {
57+
Change = true;
5758
assert(all_of(Bndl, [](auto *V) { return isa<Instruction>(V); }) &&
5859
"Expect Instructions!");
5960
auto &Ctx = Bndl[0]->getContext();
@@ -194,7 +195,10 @@ Value *BottomUpVec::vectorizeRec(ArrayRef<Value *> Bndl) {
194195
return NewVec;
195196
}
196197

197-
void BottomUpVec::tryVectorize(ArrayRef<Value *> Bndl) { vectorizeRec(Bndl); }
198+
bool BottomUpVec::tryVectorize(ArrayRef<Value *> Bndl) {
199+
vectorizeRec(Bndl);
200+
return Change;
201+
}
198202

199203
bool BottomUpVec::runOnFunction(Function &F, const Analyses &A) {
200204
Legality = std::make_unique<LegalityAnalysis>(
@@ -208,7 +212,7 @@ bool BottomUpVec::runOnFunction(Function &F, const Analyses &A) {
208212
// TODO: If vectorization succeeds, run the RegionPassManager on the
209213
// resulting region.
210214
if (Seeds.size() >= 2)
211-
tryVectorize(Seeds);
215+
Change |= tryVectorize(Seeds);
212216
}
213217
return Change;
214218
}

0 commit comments

Comments
 (0)