diff options
| author | Nicolas Vasilache <ntv@google.com> | 2022-01-05 08:19:32 -0500 |
|---|---|---|
| committer | Nicolas Vasilache <ntv@google.com> | 2022-01-05 09:31:23 -0500 |
| commit | bb2f87af0ac9ad8cc0efcb523e108e715ee9ab93 (patch) | |
| tree | 3fd81425f77c2605922907403e96ceea0da9ba0b /mlir/lib/Transforms/LoopInvariantCodeMotion.cpp | |
| parent | 2ee8154816b91201d606378a3e94a1b1bf9c0dd3 (diff) | |
[mlir] Fix missing check on nested op values in LICM
LICM checks that nested ops depend only on values defined outside
before performing hoisting.
However, it specifically omits to check for terminators which can
lead to SSA violations.
This revision fixes the incorrect behavior.
Differential Revision: https://reviews.llvm.org/D116657
Diffstat (limited to 'mlir/lib/Transforms/LoopInvariantCodeMotion.cpp')
| -rw-r--r-- | mlir/lib/Transforms/LoopInvariantCodeMotion.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/mlir/lib/Transforms/LoopInvariantCodeMotion.cpp b/mlir/lib/Transforms/LoopInvariantCodeMotion.cpp index 15462c95357d..3c8e14aa66bb 100644 --- a/mlir/lib/Transforms/LoopInvariantCodeMotion.cpp +++ b/mlir/lib/Transforms/LoopInvariantCodeMotion.cpp @@ -66,7 +66,7 @@ static bool canBeHoisted(Operation *op, // can be hoisted. for (auto ®ion : op->getRegions()) { for (auto &block : region) { - for (auto &innerOp : block.without_terminator()) + for (auto &innerOp : block) if (!canBeHoisted(&innerOp, definedOutside)) return false; } @@ -74,7 +74,6 @@ static bool canBeHoisted(Operation *op, return true; } - LogicalResult mlir::moveLoopInvariantCode(LoopLikeOpInterface looplike) { auto &loopBody = looplike.getLoopBody(); |
