From adca59e4f7d2e5e1038e0491ecc840fb04911d97 Mon Sep 17 00:00:00 2001 From: Smit Hinsu Date: Fri, 7 Dec 2018 09:30:25 -0800 Subject: 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 --- mlir/lib/Transforms/MaterializeVectors.cpp | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) (limited to 'mlir/lib/Transforms/MaterializeVectors.cpp') 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(stmt)) { - stmt->emitError("NYI path ForStmt"); - return true; - } + if (isa(stmt)) + return stmt->emitError("NYI path ForStmt"); - if (isa(stmt)) { - stmt->emitError("NYI path IfStmt"); - return true; - } + if (isa(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) { -- cgit v1.2.3