Verifier: Prefer early continue over if-nesting, NFC
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Wed, 20 Apr 2016 18:27:18 +0000 (18:27 +0000)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Wed, 20 Apr 2016 18:27:18 +0000 (18:27 +0000)
llvm-svn: 266897

llvm/lib/IR/Verifier.cpp

index f010fd3..e643dff 100644 (file)
@@ -258,15 +258,16 @@ public:
       return false;
     }
     for (const BasicBlock &BB : F) {
-      if (BB.empty() || !BB.back().isTerminator()) {
-        if (OS) {
-          *OS << "Basic Block in function '" << F.getName()
-              << "' does not have terminator!\n";
-          BB.printAsOperand(*OS, true);
-          *OS << "\n";
-        }
-        return false;
+      if (!BB.empty() && BB.back().isTerminator())
+        continue;
+
+      if (OS) {
+        *OS << "Basic Block in function '" << F.getName()
+            << "' does not have terminator!\n";
+        BB.printAsOperand(*OS, true);
+        *OS << "\n";
       }
+      return false;
     }
 
     // Now directly compute a dominance tree. We don't rely on the pass