Share some code
authorChris Lattner <sabre@nondot.org>
Thu, 10 Jun 2004 01:57:38 +0000 (01:57 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 10 Jun 2004 01:57:38 +0000 (01:57 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14106 91177308-0d34-0410-b5e6-96231b3b80d8

lib/VMCore/iOperators.cpp

index b2569e61836d97013d2c20fc904d82be902107c7..afbeb9707cbef5d6180a17055b7e9b3e8583d68e 100644 (file)
@@ -73,17 +73,9 @@ BinaryOperator *BinaryOperator::create(BinaryOps Op, Value *S1, Value *S2,
 BinaryOperator *BinaryOperator::create(BinaryOps Op, Value *S1, Value *S2,
                                       const std::string &Name,
                                        BasicBlock *InsertAtEnd) {
-  assert(S1->getType() == S2->getType() &&
-         "Cannot create binary operator with two operands of differing type!");
-  switch (Op) {
-  // Binary comparison operators...
-  case SetLT: case SetGT: case SetLE:
-  case SetGE: case SetEQ: case SetNE:
-    return new SetCondInst(Op, S1, S2, Name, InsertAtEnd);
-
-  default:
-    return new BinaryOperator(Op, S1, S2, S1->getType(), Name, InsertAtEnd);
-  }
+  BinaryOperator *Res = create(Op, S1, S2, Name);
+  InsertAtEnd->getInstList().push_back(Res);
+  return Res;
 }
 
 BinaryOperator *BinaryOperator::createNeg(Value *Op, const std::string &Name,