diff options
| author | Chris Lattner <clattner@google.com> | 2018-12-26 11:21:53 -0800 |
|---|---|---|
| committer | jpienaar <jpienaar@google.com> | 2019-03-29 14:36:35 -0700 |
| commit | d613f5ab65bbb80c3f5a0a38fef22cb4878c4358 (patch) | |
| tree | dfa4207dd899f87741ad784fe8fc343afba6885d /mlir/lib/Analysis/Verifier.cpp | |
| parent | 9a4060d3f50f046973d4e0b61f324bbc6ebbbdb9 (diff) | |
| download | bcm5719-llvm-d613f5ab65bbb80c3f5a0a38fef22cb4878c4358.tar.gz bcm5719-llvm-d613f5ab65bbb80c3f5a0a38fef22cb4878c4358.zip | |
Refactor MLFunction to contain a StmtBlock for its body instead of inheriting
from it. This is necessary progress to squaring away the parent relationship
that a StmtBlock has with its enclosing if/for/fn, and makes room for functions
to have more than one block in the future. This also removes IfClause and ForStmtBody.
This is step 5/n towards merging instructions and statements, NFC.
PiperOrigin-RevId: 226936541
Diffstat (limited to 'mlir/lib/Analysis/Verifier.cpp')
| -rw-r--r-- | mlir/lib/Analysis/Verifier.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/mlir/lib/Analysis/Verifier.cpp b/mlir/lib/Analysis/Verifier.cpp index 6e1522a656f..07324ba7d52 100644 --- a/mlir/lib/Analysis/Verifier.cpp +++ b/mlir/lib/Analysis/Verifier.cpp @@ -288,8 +288,8 @@ bool MLFuncVerifier::verifyDominance() { HashTable::ScopeTy blockScope(liveValues); // The induction variable of a for statement is live within its body. - if (auto *forStmtBody = dyn_cast<ForStmtBody>(&block)) - liveValues.insert(forStmtBody->getFor(), true); + if (auto *forStmt = dyn_cast_or_null<ForStmt>(block.getContainingStmt())) + liveValues.insert(forStmt, true); for (auto &stmt : block) { // Verify that each of the operands are live. @@ -330,16 +330,16 @@ bool MLFuncVerifier::verifyDominance() { }; // Check the whole function out. - return walkBlock(fn); + return walkBlock(*fn.getBody()); } bool MLFuncVerifier::verifyReturn() { // TODO: fold return verification in the pass that verifies all statements. const char missingReturnMsg[] = "ML function must end with return statement"; - if (fn.getStatements().empty()) + if (fn.getBody()->getStatements().empty()) return failure(missingReturnMsg, fn); - const auto &stmt = fn.getStatements().back(); + const auto &stmt = fn.getBody()->getStatements().back(); if (const auto *op = dyn_cast<OperationStmt>(&stmt)) { if (!op->isReturn()) return failure(missingReturnMsg, fn); |

