summaryrefslogtreecommitdiffstats
path: root/lib/Transforms/Scalar/SROA.cpp
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2012-10-20 12:04:57 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2012-10-20 12:04:57 +0000
commit2a13242b208b80f2d20cdb3067ccb82edb7d1d0f (patch)
tree6547e661047f75323cac159062d39d58a96de95a /lib/Transforms/Scalar/SROA.cpp
parent82a1833865ce34c37a1d0d4b1eb45f730c8b9885 (diff)
downloadexternal_llvm-2a13242b208b80f2d20cdb3067ccb82edb7d1d0f.zip
external_llvm-2a13242b208b80f2d20cdb3067ccb82edb7d1d0f.tar.gz
external_llvm-2a13242b208b80f2d20cdb3067ccb82edb7d1d0f.tar.bz2
SROA: Simplify code. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166375 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/SROA.cpp')
-rw-r--r--lib/Transforms/Scalar/SROA.cpp11
1 files changed, 2 insertions, 9 deletions
diff --git a/lib/Transforms/Scalar/SROA.cpp b/lib/Transforms/Scalar/SROA.cpp
index 377a625..71c6225 100644
--- a/lib/Transforms/Scalar/SROA.cpp
+++ b/lib/Transforms/Scalar/SROA.cpp
@@ -2888,10 +2888,7 @@ private:
Value *NewPtr = getAdjustedAllocaPtr(PtrBuilder, OldPtr->getType());
// Replace the operands which were using the old pointer.
- User::op_iterator OI = PN.op_begin(), OE = PN.op_end();
- for (; OI != OE; ++OI)
- if (*OI == OldPtr)
- *OI = NewPtr;
+ std::replace(PN.op_begin(), PN.op_end(), cast<Value>(OldPtr), NewPtr);
DEBUG(dbgs() << " to: " << PN << "\n");
deleteIfTriviallyDead(OldPtr);
@@ -3261,11 +3258,7 @@ static Type *getTypePartition(const DataLayout &TD, Type *Ty,
}
// Try to build up a sub-structure.
- SmallVector<Type *, 4> ElementTys;
- do {
- ElementTys.push_back(*EI++);
- } while (EI != EE);
- StructType *SubTy = StructType::get(STy->getContext(), ElementTys,
+ StructType *SubTy = StructType::get(STy->getContext(), makeArrayRef(EI, EE),
STy->isPacked());
const StructLayout *SubSL = TD.getStructLayout(SubTy);
if (Size != SubSL->getSizeInBytes())