Apply clang-tidy fixes for llvm-else-after-return in OpenMPDialect.cpp (NFC)
authorMehdi Amini <joker.eph@gmail.com>
Mon, 16 May 2022 10:04:49 +0000 (10:04 +0000)
committerMehdi Amini <joker.eph@gmail.com>
Wed, 18 May 2022 16:15:46 +0000 (16:15 +0000)
mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp

index 565744c..3c86243 100644 (file)
@@ -978,15 +978,15 @@ LogicalResult CancelOp::verify() {
     if (!isa<WsLoopOp>(parentOp)) {
       return emitOpError() << "cancel loop must appear "
                            << "inside a worksharing-loop region";
-    } else {
-      if (cast<WsLoopOp>(parentOp).nowaitAttr()) {
-        return emitError() << "A worksharing construct that is canceled "
-                           << "must not have a nowait clause";
-      } else if (cast<WsLoopOp>(parentOp).ordered_valAttr()) {
-        return emitError() << "A worksharing construct that is canceled "
-                           << "must not have an ordered clause";
-      }
     }
+    if (cast<WsLoopOp>(parentOp).nowaitAttr()) {
+      return emitError() << "A worksharing construct that is canceled "
+                         << "must not have a nowait clause";
+    } else if (cast<WsLoopOp>(parentOp).ordered_valAttr()) {
+      return emitError() << "A worksharing construct that is canceled "
+                         << "must not have an ordered clause";
+    }
+
   } else if (cct == ClauseCancellationConstructType::Sections) {
     if (!(isa<SectionsOp>(parentOp) || isa<SectionOp>(parentOp))) {
       return emitOpError() << "cancel sections must appear "
@@ -1023,8 +1023,9 @@ LogicalResult CancellationPointOp::verify() {
       !isa<WsLoopOp>(parentOp)) {
     return emitOpError() << "cancellation point loop must appear "
                          << "inside a worksharing-loop region";
-  } else if ((cct == ClauseCancellationConstructType::Sections) &&
-             !(isa<SectionsOp>(parentOp) || isa<SectionOp>(parentOp))) {
+  }
+  if ((cct == ClauseCancellationConstructType::Sections) &&
+      !(isa<SectionsOp>(parentOp) || isa<SectionOp>(parentOp))) {
     return emitOpError() << "cancellation point sections must appear "
                          << "inside a sections region";
   }