diff options
| author | River Riddle <riverriddle@google.com> | 2019-01-26 12:40:12 -0800 |
|---|---|---|
| committer | jpienaar <jpienaar@google.com> | 2019-03-29 15:40:23 -0700 |
| commit | 36babbd7815519db5d26f55695fa3ec500997bcd (patch) | |
| tree | 9686f3f296ff2d849ffb2f69434e50b4e6fce901 /mlir/lib/Transforms/Vectorize.cpp | |
| parent | 0e7a8a9027c5f5862c3c78f41c777ba2930f9b23 (diff) | |
| download | bcm5719-llvm-36babbd7815519db5d26f55695fa3ec500997bcd.tar.gz bcm5719-llvm-36babbd7815519db5d26f55695fa3ec500997bcd.zip | |
Change the ForInst induction variable to be a block argument of the body instead of the ForInst itself. This is a necessary step in converting ForInst into an operation.
PiperOrigin-RevId: 231064139
Diffstat (limited to 'mlir/lib/Transforms/Vectorize.cpp')
| -rw-r--r-- | mlir/lib/Transforms/Vectorize.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/mlir/lib/Transforms/Vectorize.cpp b/mlir/lib/Transforms/Vectorize.cpp index e9b37fcc04c..cfde1ecf0a8 100644 --- a/mlir/lib/Transforms/Vectorize.cpp +++ b/mlir/lib/Transforms/Vectorize.cpp @@ -881,8 +881,9 @@ static bool vectorizeForInst(ForInst *loop, int64_t step, auto load = opInst->dyn_cast<LoadOp>(); auto store = opInst->dyn_cast<StoreOp>(); LLVM_DEBUG(opInst->print(dbgs())); - auto fail = load ? vectorizeRootOrTerminal(loop, load, state) - : vectorizeRootOrTerminal(loop, store, state); + auto fail = + load ? vectorizeRootOrTerminal(loop->getInductionVar(), load, state) + : vectorizeRootOrTerminal(loop->getInductionVar(), store, state); if (fail) { return fail; } @@ -1210,7 +1211,8 @@ static bool vectorizeRootMatches(NestedMatch matches, /// RAII. ScopeGuard sg2([&fail, loop, clonedLoop]() { if (fail) { - loop->replaceAllUsesWith(clonedLoop); + loop->getInductionVar()->replaceAllUsesWith( + clonedLoop->getInductionVar()); loop->erase(); } else { clonedLoop->erase(); |

