diff options
author | Chris Lattner <sabre@nondot.org> | 2012-01-25 06:02:56 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2012-01-25 06:02:56 +0000 |
commit | 47a86bdbe2e5542a35278151a772d4ae7811088d (patch) | |
tree | 1e34020e9e2f81c25ccb367fa52a3ae528530526 /llvm/lib/VMCore/Instructions.cpp | |
parent | f07b612313702d86caab5011864140260e12d0bd (diff) | |
download | bcm5719-llvm-47a86bdbe2e5542a35278151a772d4ae7811088d.tar.gz bcm5719-llvm-47a86bdbe2e5542a35278151a772d4ae7811088d.zip |
use ConstantVector::getSplat in a few places.
llvm-svn: 148929
Diffstat (limited to 'llvm/lib/VMCore/Instructions.cpp')
-rw-r--r-- | llvm/lib/VMCore/Instructions.cpp | 27 |
1 files changed, 4 insertions, 23 deletions
diff --git a/llvm/lib/VMCore/Instructions.cpp b/llvm/lib/VMCore/Instructions.cpp index 2c6987485ff..d221af07862 100644 --- a/llvm/lib/VMCore/Instructions.cpp +++ b/llvm/lib/VMCore/Instructions.cpp @@ -1873,46 +1873,27 @@ BinaryOperator *BinaryOperator::CreateNUWNeg(Value *Op, const Twine &Name, BinaryOperator *BinaryOperator::CreateFNeg(Value *Op, const Twine &Name, Instruction *InsertBefore) { Value *zero = ConstantFP::getZeroValueForNegation(Op->getType()); - return new BinaryOperator(Instruction::FSub, - zero, Op, + return new BinaryOperator(Instruction::FSub, zero, Op, Op->getType(), Name, InsertBefore); } BinaryOperator *BinaryOperator::CreateFNeg(Value *Op, const Twine &Name, BasicBlock *InsertAtEnd) { Value *zero = ConstantFP::getZeroValueForNegation(Op->getType()); - return new BinaryOperator(Instruction::FSub, - zero, Op, + return new BinaryOperator(Instruction::FSub, zero, Op, Op->getType(), Name, InsertAtEnd); } BinaryOperator *BinaryOperator::CreateNot(Value *Op, const Twine &Name, Instruction *InsertBefore) { - Constant *C; - if (VectorType *PTy = dyn_cast<VectorType>(Op->getType())) { - C = Constant::getAllOnesValue(PTy->getElementType()); - C = ConstantVector::get( - std::vector<Constant*>(PTy->getNumElements(), C)); - } else { - C = Constant::getAllOnesValue(Op->getType()); - } - + Constant *C = Constant::getAllOnesValue(Op->getType()); return new BinaryOperator(Instruction::Xor, Op, C, Op->getType(), Name, InsertBefore); } BinaryOperator *BinaryOperator::CreateNot(Value *Op, const Twine &Name, BasicBlock *InsertAtEnd) { - Constant *AllOnes; - if (VectorType *PTy = dyn_cast<VectorType>(Op->getType())) { - // Create a vector of all ones values. - Constant *Elt = Constant::getAllOnesValue(PTy->getElementType()); - AllOnes = ConstantVector::get( - std::vector<Constant*>(PTy->getNumElements(), Elt)); - } else { - AllOnes = Constant::getAllOnesValue(Op->getType()); - } - + Constant *AllOnes = Constant::getAllOnesValue(Op->getType()); return new BinaryOperator(Instruction::Xor, Op, AllOnes, Op->getType(), Name, InsertAtEnd); } |