aboutsummaryrefslogtreecommitdiffstats
path: root/lib/VMCore
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2012-01-25 06:02:56 +0000
committerChris Lattner <sabre@nondot.org>2012-01-25 06:02:56 +0000
commit4ca829e89567f002fc74eb0e3e532a7c7662e031 (patch)
treed378bc96ed1aeb7ed0e40fc7f61d46aad65ee203 /lib/VMCore
parent4bb3f34b2296f0ec70751f332cf7ef96d2d30a48 (diff)
downloadexternal_llvm-4ca829e89567f002fc74eb0e3e532a7c7662e031.zip
external_llvm-4ca829e89567f002fc74eb0e3e532a7c7662e031.tar.gz
external_llvm-4ca829e89567f002fc74eb0e3e532a7c7662e031.tar.bz2
use ConstantVector::getSplat in a few places.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148929 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore')
-rw-r--r--lib/VMCore/Instructions.cpp27
1 files changed, 4 insertions, 23 deletions
diff --git a/lib/VMCore/Instructions.cpp b/lib/VMCore/Instructions.cpp
index 2c69874..d221af0 100644
--- a/lib/VMCore/Instructions.cpp
+++ b/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);
}