diff options
| author | Alex Zinenko <zinenko@google.com> | 2019-12-04 07:41:55 -0800 |
|---|---|---|
| committer | A. Unique TensorFlower <gardener@tensorflow.org> | 2019-12-04 07:42:29 -0800 |
| commit | 75175134d46dd63fda804697cbd3e66e8213a01b (patch) | |
| tree | 9ec6d147c3993e1f690f6bb5fa9f4414d38c0750 /mlir/lib/Transforms/Utils | |
| parent | f7c6bc70a926bf2fb790c4cfc2b6023dd21be622 (diff) | |
| download | bcm5719-llvm-75175134d46dd63fda804697cbd3e66e8213a01b.tar.gz bcm5719-llvm-75175134d46dd63fda804697cbd3e66e8213a01b.zip | |
Loop coalescing: fix pointer chainsing in use-chain traversal
In the replaceAllUsesExcept utility function called from loop coalescing the
iteration over the use-chain is incorrect. The use list nodes (IROperands) have
next/prev links, and bluntly resetting the use would make the loop to continue
on uses of the value that was replaced instead of the original one. As a
result, it could miss the existing uses and update the wrong ones. Make sure we
increment the iterator before updating the use in the loop body.
Reported-by: Uday Bondhugula <uday@polymagelabs.com>
Closes tensorflow/mlir#291.
PiperOrigin-RevId: 283754195
Diffstat (limited to 'mlir/lib/Transforms/Utils')
| -rw-r--r-- | mlir/lib/Transforms/Utils/LoopUtils.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/mlir/lib/Transforms/Utils/LoopUtils.cpp b/mlir/lib/Transforms/Utils/LoopUtils.cpp index 0ee1220b720..7b38809ce49 100644 --- a/mlir/lib/Transforms/Utils/LoopUtils.cpp +++ b/mlir/lib/Transforms/Utils/LoopUtils.cpp @@ -979,7 +979,7 @@ TileLoops mlir::extractFixedOuterLoops(loop::ForOp rootForOp, static void replaceAllUsesExcept(Value *orig, Value *replacement, const SmallPtrSetImpl<Operation *> &exceptions) { - for (auto &use : orig->getUses()) { + for (auto &use : llvm::make_early_inc_range(orig->getUses())) { if (exceptions.count(use.getOwner()) == 0) use.set(replacement); } |

