1//===- SROA.cpp - Scalar Replacement Of Aggregates ------------------------===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// --- 2683 unchanged lines hidden (view full) --- 2692 assert(BeginOffset >= NewAllocaBeginOffset && "PHIs are unsplittable"); 2693 assert(EndOffset <= NewAllocaEndOffset && "PHIs are unsplittable"); 2694 2695 // We would like to compute a new pointer in only one place, but have it be 2696 // as local as possible to the PHI. To do that, we re-use the location of 2697 // the old pointer, which necessarily must be in the right position to 2698 // dominate the PHI. 2699 IRBuilderTy PtrBuilder(IRB); |
2700 if (isa<PHINode>(OldPtr)) 2701 PtrBuilder.SetInsertPoint(OldPtr->getParent()->getFirstInsertionPt()); 2702 else 2703 PtrBuilder.SetInsertPoint(OldPtr); |
2704 PtrBuilder.SetCurrentDebugLocation(OldPtr->getDebugLoc()); 2705 2706 Value *NewPtr = getNewAllocaSlicePtr(PtrBuilder, OldPtr->getType()); 2707 // Replace the operands which were using the old pointer. 2708 std::replace(PN.op_begin(), PN.op_end(), cast<Value>(OldPtr), NewPtr); 2709 2710 DEBUG(dbgs() << " to: " << PN << "\n"); 2711 deleteIfTriviallyDead(OldPtr); --- 960 unchanged lines hidden --- |