diff options
| author | Smit Hinsu <hinsu@google.com> | 2018-12-07 09:30:25 -0800 |
|---|---|---|
| committer | jpienaar <jpienaar@google.com> | 2019-03-29 14:22:06 -0700 |
| commit | adca59e4f7d2e5e1038e0491ecc840fb04911d97 (patch) | |
| tree | 67bfe391234a08d3ce365db3798a1e6287d4fbab /mlir/lib/Transforms/MaterializeVectors.cpp | |
| parent | d2d7c11f197e3e93af390dc9a9cc3ba82c152b10 (diff) | |
| download | bcm5719-llvm-adca59e4f7d2e5e1038e0491ecc840fb04911d97.tar.gz bcm5719-llvm-adca59e4f7d2e5e1038e0491ecc840fb04911d97.zip | |
Return bool from all emitError methods similar to Operation::emitOpError
This simplifies call-sites returning true after emitting an error. After the
conversion, dropped braces around single statement blocks as that seems more
common.
Also, switched to emitError method instead of emitting Error kind using the
emitDiagnostic method.
TESTED with existing unit tests
PiperOrigin-RevId: 224527868
Diffstat (limited to 'mlir/lib/Transforms/MaterializeVectors.cpp')
| -rw-r--r-- | mlir/lib/Transforms/MaterializeVectors.cpp | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/mlir/lib/Transforms/MaterializeVectors.cpp b/mlir/lib/Transforms/MaterializeVectors.cpp index 3bf4305ca0c..b5e0f75406e 100644 --- a/mlir/lib/Transforms/MaterializeVectors.cpp +++ b/mlir/lib/Transforms/MaterializeVectors.cpp @@ -535,15 +535,11 @@ static bool instantiateMaterialization(Statement *stmt, MaterializationState *state) { LLVM_DEBUG(dbgs() << "\ninstantiate: " << *stmt); - if (isa<ForStmt>(stmt)) { - stmt->emitError("NYI path ForStmt"); - return true; - } + if (isa<ForStmt>(stmt)) + return stmt->emitError("NYI path ForStmt"); - if (isa<IfStmt>(stmt)) { - stmt->emitError("NYI path IfStmt"); - return true; - } + if (isa<IfStmt>(stmt)) + return stmt->emitError("NYI path IfStmt"); // Create a builder here for unroll-and-jam effects. MLFuncBuilder b(stmt); @@ -562,14 +558,10 @@ static bool instantiateMaterialization(Statement *stmt, // The only op with 0 results reaching this point must, by construction, be // VectorTransferWriteOps and have been caught above. Ops with >= 2 results // are not yet supported. So just support 1 result. - if (opStmt->getNumResults() != 1) { - stmt->emitError("NYI: ops with != 1 results"); - return true; - } - if (opStmt->getResult(0)->getType() != state->superVectorType) { - stmt->emitError("Op does not return a supervector."); - return true; - } + if (opStmt->getNumResults() != 1) + return stmt->emitError("NYI: ops with != 1 results"); + if (opStmt->getResult(0)->getType() != state->superVectorType) + return stmt->emitError("Op does not return a supervector."); auto *clone = instantiate(&b, opStmt, state->hwVectorType, state->substitutionsMap); if (!clone) { |

