[llvm] r266897 - Verifier: Prefer early continue over if-nesting, NFC

Duncan P. N. Exon Smith via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 20 11:27:18 PDT 2016


Author: dexonsmith
Date: Wed Apr 20 13:27:18 2016
New Revision: 266897

URL: http://llvm.org/viewvc/llvm-project?rev=266897&view=rev
Log:
Verifier: Prefer early continue over if-nesting, NFC

Modified:
    llvm/trunk/lib/IR/Verifier.cpp

Modified: llvm/trunk/lib/IR/Verifier.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Verifier.cpp?rev=266897&r1=266896&r2=266897&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Verifier.cpp (original)
+++ llvm/trunk/lib/IR/Verifier.cpp Wed Apr 20 13:27:18 2016
@@ -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




More information about the llvm-commits mailing list