-// ReplaceInstWithInst - Replace the instruction specified by BI with the
-// instruction specified by I. The original instruction is deleted and BI is
-// updated to point to the new instruction.
-//
-void ReplaceInstWithInst(BasicBlock::InstListType &BIL,
- BasicBlock::iterator &BI, Instruction *I) {
- assert(I->getParent() == 0 &&
- "ReplaceInstWithInst: Instruction already inserted into basic block!");
-
- // Insert the new instruction into the basic block...
- BI = BIL.insert(BI, I)+1;
-
- // Replace all uses of the old instruction, and delete it.
- ReplaceInstWithValue(BIL, BI, I);
-
- // Reexamine the instruction just inserted next time around the cleanup pass
- // loop.
- --BI;
-}
+static const Type *getStructOffsetStep(const StructType *STy, uint64_t &Offset,
+ std::vector<Value*> &Indices) {
+ assert(Offset < TD.getTypeSize(STy) && "Offset not in composite!");
+ const StructLayout *SL = TD.getStructLayout(STy);