Start using the new function cloning header
[oota-llvm.git] / lib / VMCore / iBranch.cpp
index f020ab621377acb0323d2948b7624fd2fd621c50..3ad36d13ee2adedfd9cf3cec21e6b53315a97f1e 100644 (file)
@@ -7,14 +7,11 @@
 
 #include "llvm/iTerminators.h"
 #include "llvm/BasicBlock.h"
-#ifndef NDEBUG
-#include "llvm/Type.h"       // Only used for assertions...
-#include "llvm/Assembly/Writer.h"
-#include <iostream>
-#endif
+#include "llvm/Type.h"
 
-BranchInst::BranchInst(BasicBlock *True, BasicBlock *False, Value *Cond) 
-  : TerminatorInst(Instruction::Br) {
+BranchInst::BranchInst(BasicBlock *True, BasicBlock *False, Value *Cond,
+                       Instruction *InsertBefore) 
+  : TerminatorInst(Instruction::Br, InsertBefore) {
   assert(True != 0 && "True branch destination may not be null!!!");
   Operands.reserve(False ? 3 : 1);
   Operands.push_back(Use(True, this));
@@ -25,15 +22,17 @@ BranchInst::BranchInst(BasicBlock *True, BasicBlock *False, Value *Cond)
 
   assert(!!False == !!Cond &&
         "Either both cond and false or neither can be specified!");
-
-#ifndef NDEBUG
-  if (Cond != 0 && Cond->getType() != Type::BoolTy)
-    std::cerr << "Bad Condition: " << Cond << "\n";
-#endif
   assert((Cond == 0 || Cond->getType() == Type::BoolTy) && 
          "May only branch on boolean predicates!!!!");
 }
 
+BranchInst::BranchInst(BasicBlock *True, Instruction *InsertBefore) 
+  : TerminatorInst(Instruction::Br, InsertBefore) {
+  assert(True != 0 && "True branch destination may not be null!!!");
+  Operands.reserve(1);
+  Operands.push_back(Use(True, this));
+}
+
 BranchInst::BranchInst(const BranchInst &BI) : TerminatorInst(Instruction::Br) {
   Operands.reserve(BI.Operands.size());
   Operands.push_back(Use(BI.Operands[0], this));