diff options
author | Dan Gohman <gohman@apple.com> | 2009-06-14 22:47:23 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2009-06-14 22:47:23 +0000 |
commit | a82752c9eb5fbdd1b7276fde7349ac9453eb5a75 (patch) | |
tree | 44b74fb6e291342880ff262c551f3f014257e2fe /lib/Analysis/ScalarEvolutionExpander.cpp | |
parent | ea73f3c2e14d84bb4cb07bd6a1a3d7915f3aff83 (diff) | |
download | external_llvm-a82752c9eb5fbdd1b7276fde7349ac9453eb5a75.zip external_llvm-a82752c9eb5fbdd1b7276fde7349ac9453eb5a75.tar.gz external_llvm-a82752c9eb5fbdd1b7276fde7349ac9453eb5a75.tar.bz2 |
Convert several parts of the ScalarEvolution framework to use
SmallVector instead of std::vector.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73357 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/ScalarEvolutionExpander.cpp')
-rw-r--r-- | lib/Analysis/ScalarEvolutionExpander.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/Analysis/ScalarEvolutionExpander.cpp b/lib/Analysis/ScalarEvolutionExpander.cpp index e1f8fa4..abfe94d 100644 --- a/lib/Analysis/ScalarEvolutionExpander.cpp +++ b/lib/Analysis/ScalarEvolutionExpander.cpp @@ -182,7 +182,8 @@ static bool FactorOutConstant(SCEVHandle &S, if (const SCEVMulExpr *M = dyn_cast<SCEVMulExpr>(S)) if (const SCEVConstant *C = dyn_cast<SCEVConstant>(M->getOperand(0))) if (!C->getValue()->getValue().srem(Factor)) { - std::vector<SCEVHandle> NewMulOps(M->getOperands()); + const SmallVectorImpl<SCEVHandle> &MOperands = M->getOperands(); + SmallVector<SCEVHandle, 4> NewMulOps(MOperands.begin(), MOperands.end()); NewMulOps[0] = SE.getConstant(C->getValue()->getValue().sdiv(Factor)); S = SE.getMulExpr(NewMulOps); @@ -239,7 +240,7 @@ Value *SCEVExpander::expandAddToGEP(const SCEVHandle *op_begin, Value *V) { const Type *ElTy = PTy->getElementType(); SmallVector<Value *, 4> GepIndices; - std::vector<SCEVHandle> Ops(op_begin, op_end); + SmallVector<SCEVHandle, 8> Ops(op_begin, op_end); bool AnyNonZeroIndices = false; // Decend down the pointer's type and attempt to convert the other @@ -250,8 +251,8 @@ Value *SCEVExpander::expandAddToGEP(const SCEVHandle *op_begin, for (;;) { APInt ElSize = APInt(SE.getTypeSizeInBits(Ty), ElTy->isSized() ? SE.TD->getTypeAllocSize(ElTy) : 0); - std::vector<SCEVHandle> NewOps; - std::vector<SCEVHandle> ScaledOps; + SmallVector<SCEVHandle, 8> NewOps; + SmallVector<SCEVHandle, 8> ScaledOps; for (unsigned i = 0, e = Ops.size(); i != e; ++i) { // Split AddRecs up into parts as either of the parts may be usable // without the other. @@ -365,7 +366,7 @@ Value *SCEVExpander::visitAddExpr(const SCEVAddExpr *S) { // comments on expandAddToGEP for details. if (SE.TD) if (const PointerType *PTy = dyn_cast<PointerType>(V->getType())) { - const std::vector<SCEVHandle> &Ops = S->getOperands(); + const SmallVectorImpl<SCEVHandle> &Ops = S->getOperands(); return expandAddToGEP(&Ops[0], &Ops[Ops.size() - 1], PTy, Ty, V); } @@ -432,7 +433,7 @@ static void ExposePointerBase(SCEVHandle &Base, SCEVHandle &Rest, } if (const SCEVAddExpr *A = dyn_cast<SCEVAddExpr>(Base)) { Base = A->getOperand(A->getNumOperands()-1); - std::vector<SCEVHandle> NewAddOps(A->op_begin(), A->op_end()); + SmallVector<SCEVHandle, 8> NewAddOps(A->op_begin(), A->op_end()); NewAddOps.back() = Rest; Rest = SE.getAddExpr(NewAddOps); ExposePointerBase(Base, Rest, SE); @@ -473,7 +474,8 @@ Value *SCEVExpander::visitAddRecExpr(const SCEVAddRecExpr *S) { // {X,+,F} --> X + {0,+,F} if (!S->getStart()->isZero()) { - std::vector<SCEVHandle> NewOps(S->getOperands()); + const SmallVectorImpl<SCEVHandle> &SOperands = S->getOperands(); + SmallVector<SCEVHandle, 4> NewOps(SOperands.begin(), SOperands.end()); NewOps[0] = SE.getIntegerSCEV(0, Ty); SCEVHandle Rest = SE.getAddRecExpr(NewOps, L); |