Don't print 'No predecessors!' on the entry block
authorChris Lattner <sabre@nondot.org>
Sun, 16 Nov 2003 22:59:57 +0000 (22:59 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 16 Nov 2003 22:59:57 +0000 (22:59 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10038 91177308-0d34-0410-b5e6-96231b3b80d8

lib/VMCore/AsmWriter.cpp

index 67ccdd0f8deacc6c04a73d3b2ea4649027ee9150..da3826019ab3487deec68c1e06b268b7dd87dd9d 100644 (file)
@@ -748,18 +748,20 @@ void AssemblyWriter::printBasicBlock(const BasicBlock *BB) {
       Out << "<badref>"; 
   }
   
-  // Output predecessors for the block...
-  Out << "\t\t;";
-  pred_const_iterator PI = pred_begin(BB), PE = pred_end(BB);
-
-  if (PI == PE) {
-    Out << " No predecessors!";
-  } else {
-    Out << " preds =";
-    writeOperand(*PI, false, true);
-    for (++PI; PI != PE; ++PI) {
-      Out << ",";
+  if (BB != &BB->getParent()->front()) {  // Not the entry block?
+    // Output predecessors for the block...
+    Out << "\t\t;";
+    pred_const_iterator PI = pred_begin(BB), PE = pred_end(BB);
+    
+    if (PI == PE) {
+      Out << " No predecessors!";
+    } else {
+      Out << " preds =";
       writeOperand(*PI, false, true);
+      for (++PI; PI != PE; ++PI) {
+        Out << ",";
+        writeOperand(*PI, false, true);
+      }
     }
   }