summaryrefslogtreecommitdiff
path: root/lib/VMCore/ConstantFold.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2011-02-14 07:55:32 +0000
committerChris Lattner <sabre@nondot.org>2011-02-14 07:55:32 +0000
commit283c8caccd093f8e1d4f0bdd01ac240b4edbd20a (patch)
treebf56193b8f9bd39bcb2ffd3251e27f67d7953a2e /lib/VMCore/ConstantFold.cpp
parent2b9bc422a5e6840f5b925316bc06d5943deb610a (diff)
downloadllvm-283c8caccd093f8e1d4f0bdd01ac240b4edbd20a.tar.gz
llvm-283c8caccd093f8e1d4f0bdd01ac240b4edbd20a.tar.bz2
llvm-283c8caccd093f8e1d4f0bdd01ac240b4edbd20a.tar.xz
Switch ConstantVector::get to use ArrayRef instead of a pointer+size
idiom. Change various clients to simplify their code. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125487 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/ConstantFold.cpp')
-rw-r--r--lib/VMCore/ConstantFold.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/VMCore/ConstantFold.cpp b/lib/VMCore/ConstantFold.cpp
index 1b50c4aa9d..c8292c6d61 100644
--- a/lib/VMCore/ConstantFold.cpp
+++ b/lib/VMCore/ConstantFold.cpp
@@ -150,7 +150,7 @@ static Constant *FoldBitCast(Constant *V, const Type *DestTy) {
// This allows for other simplifications (although some of them
// can only be handled by Analysis/ConstantFolding.cpp).
if (isa<ConstantInt>(V) || isa<ConstantFP>(V))
- return ConstantExpr::getBitCast(ConstantVector::get(&V, 1), DestPTy);
+ return ConstantExpr::getBitCast(ConstantVector::get(V), DestPTy);
}
// Finally, implement bitcast folding now. The code below doesn't handle
@@ -873,7 +873,7 @@ Constant *llvm::ConstantFoldShuffleVectorInstruction(Constant *V1,
Result.push_back(InElt);
}
- return ConstantVector::get(&Result[0], Result.size());
+ return ConstantVector::get(Result);
}
Constant *llvm::ConstantFoldExtractValueInstruction(Constant *Agg,
@@ -1947,11 +1947,11 @@ Constant *llvm::ConstantFoldCompareInstruction(unsigned short pred,
// If we can constant fold the comparison of each element, constant fold
// the whole vector comparison.
SmallVector<Constant*, 4> ResElts;
- for (unsigned i = 0, e = C1Elts.size(); i != e; ++i) {
- // Compare the elements, producing an i1 result or constant expr.
+ // Compare the elements, producing an i1 result or constant expr.
+ for (unsigned i = 0, e = C1Elts.size(); i != e; ++i)
ResElts.push_back(ConstantExpr::getCompare(pred, C1Elts[i], C2Elts[i]));
- }
- return ConstantVector::get(&ResElts[0], ResElts.size());
+
+ return ConstantVector::get(ResElts);
}
if (C1->getType()->isFloatingPointTy()) {