[llvm-commits] CVS: llvm-java/lib/Compiler/Compiler.cpp

Alkis Evlogimenos alkis at cs.uiuc.edu
Wed Sep 15 12:31:32 PDT 2004



Changes in directory llvm-java/lib/Compiler:

Compiler.cpp updated: 1.101 -> 1.102
---
Log message:

Insert fall through branches to basic blocks without a
terminator. These are basic blocks in switch blocks without a break
statement.


---
Diffs of the changes:  (+9 -0)

Index: llvm-java/lib/Compiler/Compiler.cpp
diff -u llvm-java/lib/Compiler/Compiler.cpp:1.101 llvm-java/lib/Compiler/Compiler.cpp:1.102
--- llvm-java/lib/Compiler/Compiler.cpp:1.101	Wed Sep 15 14:01:04 2004
+++ llvm-java/lib/Compiler/Compiler.cpp	Wed Sep 15 14:31:21 2004
@@ -767,6 +767,15 @@
         new BranchInst(prologue_->getNext(), prologue_);
       }
 
+      // now scan the basic blocks of this function and insert fall
+      // through branches to all basic blocks that don't have a
+      // terminator (these are blocks in switch blocks without a break
+      // statement)
+      for (Function::iterator
+             BB = function->begin(), BBE = function->end(); BB != BBE; ++BB)
+        if (!BB->getTerminator())
+          new BranchInst(next(BB), BB);
+
       return function;
     }
 






More information about the llvm-commits mailing list