[llvm-commits] [llvm] r166375 - /llvm/trunk/lib/Transforms/Scalar/SROA.cpp
Benjamin Kramer
benny.kra at googlemail.com
Sat Oct 20 05:04:57 PDT 2012
Author: d0k
Date: Sat Oct 20 07:04:57 2012
New Revision: 166375
URL: http://llvm.org/viewvc/llvm-project?rev=166375&view=rev
Log:
SROA: Simplify code. No functionality change.
Modified:
llvm/trunk/lib/Transforms/Scalar/SROA.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/SROA.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SROA.cpp?rev=166375&r1=166374&r2=166375&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/SROA.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/SROA.cpp Sat Oct 20 07:04:57 2012
@@ -2888,10 +2888,7 @@
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 @@
}
// 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())
More information about the llvm-commits
mailing list