// values and replace the LPI with that aggregate.
Type *LPadType = LPI->getType();
Value *LPadVal = UndefValue::get(LPadType);
- IRBuilder<> Builder(
- std::next(BasicBlock::iterator(cast<Instruction>(SelVal))));
+ auto *SelI = cast<Instruction>(SelVal);
+ IRBuilder<> Builder(SelI->getParent(), std::next(SelI->getIterator()));
LPadVal = Builder.CreateInsertValue(LPadVal, ExnVal, 0, "lpad.val");
LPadVal = Builder.CreateInsertValue(LPadVal, SelVal, 1, "lpad.val");
/// it with all of the data that we know at this point.
Value *SjLjEHPrepare::setupFunctionContext(Function &F,
ArrayRef<LandingPadInst *> LPads) {
- BasicBlock *EntryBB = F.begin();
+ BasicBlock *EntryBB = &F.front();
// Create an alloca for the incoming jump buffer ptr and the new jump buffer
// that needs to be restored on all exits from the function. This is an alloca
auto &DL = F.getParent()->getDataLayout();
unsigned Align = DL.getPrefTypeAlignment(FunctionContextTy);
FuncCtx = new AllocaInst(FunctionContextTy, nullptr, Align, "fn_context",
- EntryBB->begin());
+ &EntryBB->front());
// Fill in the function context structure.
for (unsigned I = 0, E = LPads.size(); I != E; ++I) {
LandingPadInst *LPI = LPads[I];
- IRBuilder<> Builder(LPI->getParent()->getFirstInsertionPt());
+ IRBuilder<> Builder(LPI->getParent(),
+ LPI->getParent()->getFirstInsertionPt());
// Reference the __data field.
Value *FCData =
while (isa<AllocaInst>(AfterAllocaInsPt) &&
isa<ConstantInt>(cast<AllocaInst>(AfterAllocaInsPt)->getArraySize()))
++AfterAllocaInsPt;
+ assert(AfterAllocaInsPt != F.front().end());
- for (Function::arg_iterator AI = F.arg_begin(), AE = F.arg_end(); AI != AE;
- ++AI) {
- Type *Ty = AI->getType();
+ for (auto &AI : F.args()) {
+ Type *Ty = AI.getType();
// Use 'select i8 true, %arg, undef' to simulate a 'no-op' instruction.
Value *TrueValue = ConstantInt::getTrue(F.getContext());
Value *UndefValue = UndefValue::get(Ty);
- Instruction *SI = SelectInst::Create(TrueValue, AI, UndefValue,
- AI->getName() + ".tmp",
- AfterAllocaInsPt);
- AI->replaceAllUsesWith(SI);
+ Instruction *SI = SelectInst::Create(
+ TrueValue, &AI, UndefValue, AI.getName() + ".tmp", &*AfterAllocaInsPt);
+ AI.replaceAllUsesWith(SI);
// Reset the operand, because it was clobbered by the RAUW above.
- SI->setOperand(1, AI);
+ SI->setOperand(1, &AI);
}
}
// Ignore obvious cases we don't have to handle. In particular, most
// instructions either have no uses or only have a single use inside the
// current block. Ignore them quickly.
- Instruction *Inst = II;
+ Instruction *Inst = &*II;
if (Inst->use_empty())
continue;
if (Inst->hasOneUse() &&
DemotePHIToStack(PN);
// Move the landingpad instruction back to the top of the landing pad block.
- LPI->moveBefore(UnwindBlock->begin());
+ LPI->moveBefore(&UnwindBlock->front());
}
}
Value *FuncCtx =
setupFunctionContext(F, makeArrayRef(LPads.begin(), LPads.end()));
- BasicBlock *EntryBB = F.begin();
+ BasicBlock *EntryBB = &F.front();
IRBuilder<> Builder(EntryBB->getTerminator());
// Get a reference to the jump buffer.
continue;
}
Instruction *StackAddr = CallInst::Create(StackAddrFn, "sp");
- StackAddr->insertAfter(I);
+ StackAddr->insertAfter(&*I);
Instruction *StoreStackAddr = new StoreInst(StackAddr, StackPtr, true);
StoreStackAddr->insertAfter(StackAddr);
}
BlockFrequencies.resize(mf.getNumBlockIDs());
MBFI = &getAnalysis<MachineBlockFrequencyInfo>();
setThreshold(MBFI->getEntryFreq());
- for (MachineFunction::iterator I = mf.begin(), E = mf.end(); I != E; ++I) {
- unsigned Num = I->getNumber();
- BlockFrequencies[Num] = MBFI->getBlockFreq(I);
+ for (auto &I : mf) {
+ unsigned Num = I.getNumber();
+ BlockFrequencies[Num] = MBFI->getBlockFreq(&I);
}
// We never change the function.
UseE = UseSlots.end();
// Loop over basic blocks where CurLI is live.
- MachineFunction::iterator MFI = LIS.getMBBFromIndex(LVI->start);
+ MachineFunction::iterator MFI =
+ LIS.getMBBFromIndex(LVI->start)->getIterator();
for (;;) {
BlockInfo BI;
- BI.MBB = MFI;
+ BI.MBB = &*MFI;
SlotIndex Start, Stop;
std::tie(Start, Stop) = LIS.getSlotIndexes()->getMBBRange(BI.MBB);
if (LVI->start < Stop)
++MFI;
else
- MFI = LIS.getMBBFromIndex(LVI->start);
+ MFI = LIS.getMBBFromIndex(LVI->start)->getIterator();
}
assert(getNumLiveBlocks() == countLiveBlocks(CurLI) && "Bad block count");
unsigned Count = 0;
// Loop over basic blocks where li is live.
- MachineFunction::const_iterator MFI = LIS.getMBBFromIndex(LVI->start);
- SlotIndex Stop = LIS.getMBBEndIdx(MFI);
+ MachineFunction::const_iterator MFI =
+ LIS.getMBBFromIndex(LVI->start)->getIterator();
+ SlotIndex Stop = LIS.getMBBEndIdx(&*MFI);
for (;;) {
++Count;
LVI = li->advanceTo(LVI, Stop);
return Count;
do {
++MFI;
- Stop = LIS.getMBBEndIdx(MFI);
+ Stop = LIS.getMBBEndIdx(&*MFI);
} while (Stop <= LVI->start);
}
}
// This value has multiple defs in RegIdx, but it wasn't rematerialized,
// so the live range is accurate. Add live-in blocks in [Start;End) to the
// LiveInBlocks.
- MachineFunction::iterator MBB = LIS.getMBBFromIndex(Start);
+ MachineFunction::iterator MBB = LIS.getMBBFromIndex(Start)->getIterator();
SlotIndex BlockStart, BlockEnd;
- std::tie(BlockStart, BlockEnd) = LIS.getSlotIndexes()->getMBBRange(MBB);
+ std::tie(BlockStart, BlockEnd) = LIS.getSlotIndexes()->getMBBRange(&*MBB);
// The first block may be live-in, or it may have its own def.
if (Start != BlockStart) {
DEBUG(dbgs() << ':' << VNI->id << "*BB#" << MBB->getNumber());
// MBB has its own def. Is it also live-out?
if (BlockEnd <= End)
- LRC.setLiveOutValue(MBB, VNI);
+ LRC.setLiveOutValue(&*MBB, VNI);
// Skip to the next block for live-in.
++MBB;
assert(Start <= BlockStart && "Expected live-in block");
while (BlockStart < End) {
DEBUG(dbgs() << ">BB#" << MBB->getNumber());
- BlockEnd = LIS.getMBBEndIdx(MBB);
+ BlockEnd = LIS.getMBBEndIdx(&*MBB);
if (BlockStart == ParentVNI->def) {
// This block has the def of a parent PHI, so it isn't live-in.
assert(ParentVNI->isPHIDef() && "Non-phi defined at block start?");
VNInfo *VNI = LR.extendInBlock(BlockStart, std::min(BlockEnd, End));
assert(VNI && "Missing def for complex mapped parent PHI");
if (End >= BlockEnd)
- LRC.setLiveOutValue(MBB, VNI); // Live-out as well.
+ LRC.setLiveOutValue(&*MBB, VNI); // Live-out as well.
} else {
// This block needs a live-in value. The last block covered may not
// be live-out.
if (End < BlockEnd)
- LRC.addLiveInBlock(LR, MDT[MBB], End);
+ LRC.addLiveInBlock(LR, MDT[&*MBB], End);
else {
// Live-through, and we don't know the value.
- LRC.addLiveInBlock(LR, MDT[MBB]);
- LRC.setLiveOutValue(MBB, nullptr);
+ LRC.addLiveInBlock(LR, MDT[&*MBB]);
+ LRC.setLiveOutValue(&*MBB, nullptr);
}
}
BlockStart = BlockEnd;
Value *StackGuardVar = nullptr; // The stack guard variable.
for (Function::iterator I = F->begin(), E = F->end(); I != E;) {
- BasicBlock *BB = I++;
+ BasicBlock *BB = &*I++;
ReturnInst *RI = dyn_cast<ReturnInst>(BB->getTerminator());
if (!RI)
continue;
BasicBlock *FailBB = CreateFailBB();
// Split the basic block before the return instruction.
- BasicBlock *NewBB = BB->splitBasicBlock(RI, "SP_return");
+ BasicBlock *NewBB = BB->splitBasicBlock(RI->getIterator(), "SP_return");
// Update the dominator tree if we need to.
if (DT && DT->isReachableFromEntry(BB)) {
static void VerifyPHIs(MachineFunction &MF, bool CheckExtra) {
for (MachineFunction::iterator I = ++MF.begin(), E = MF.end(); I != E; ++I) {
- MachineBasicBlock *MBB = I;
+ MachineBasicBlock *MBB = &*I;
SmallSetVector<MachineBasicBlock*, 8> Preds(MBB->pred_begin(),
MBB->pred_end());
MachineBasicBlock::iterator MI = MBB->begin();
}
for (MachineFunction::iterator I = ++MF.begin(), E = MF.end(); I != E; ) {
- MachineBasicBlock *MBB = I++;
+ MachineBasicBlock *MBB = &*I++;
if (NumTails == TailDupLimit)
break;
<< "From simple Succ: " << *TailBB);
MachineBasicBlock *NewTarget = *TailBB->succ_begin();
- MachineBasicBlock *NextBB = std::next(MachineFunction::iterator(PredBB));
+ MachineBasicBlock *NextBB = &*std::next(PredBB->getIterator());
// Make PredFBB explicit.
if (PredCond.empty())
// If TailBB was duplicated into all its predecessors except for the prior
// block, which falls through unconditionally, move the contents of this
// block into the prior block.
- MachineBasicBlock *PrevBB = std::prev(MachineFunction::iterator(TailBB));
+ MachineBasicBlock *PrevBB = &*std::prev(TailBB->getIterator());
MachineBasicBlock *PriorTBB = nullptr, *PriorFBB = nullptr;
SmallVector<MachineOperand, 4> PriorCond;
// This has to check PrevBB->succ_size() because EH edges are ignored by
unsigned RegA, unsigned RegB,
unsigned Dist) {
// FIXME: Why does convertToThreeAddress() need an iterator reference?
- MachineFunction::iterator MFI = MBB;
+ MachineFunction::iterator MFI = MBB->getIterator();
MachineInstr *NewMI = TII->convertToThreeAddress(MFI, mi, LV);
- assert(MBB == MFI && "convertToThreeAddress changed iterator reference");
+ assert(MBB->getIterator() == MFI &&
+ "convertToThreeAddress changed iterator reference");
if (!NewMI)
return false;
TiedOperandMap TiedOperands;
for (MachineFunction::iterator MBBI = MF->begin(), MBBE = MF->end();
MBBI != MBBE; ++MBBI) {
- MBB = MBBI;
+ MBB = &*MBBI;
unsigned Dist = 0;
DistanceMap.clear();
SrcRegMap.clear();
// in them.
std::vector<BasicBlock*> DeadBlocks;
for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I)
- if (!Reachable.count(I)) {
- BasicBlock *BB = I;
+ if (!Reachable.count(&*I)) {
+ BasicBlock *BB = &*I;
DeadBlocks.push_back(BB);
while (PHINode *PN = dyn_cast<PHINode>(BB->begin())) {
PN->replaceAllUsesWith(Constant::getNullValue(PN->getType()));
// in them.
std::vector<MachineBasicBlock*> DeadBlocks;
for (MachineFunction::iterator I = F.begin(), E = F.end(); I != E; ++I) {
- MachineBasicBlock *BB = I;
+ MachineBasicBlock *BB = &*I;
// Test for deadness.
if (!Reachable.count(BB)) {
// Cleanup PHI nodes.
for (MachineFunction::iterator I = F.begin(), E = F.end(); I != E; ++I) {
- MachineBasicBlock *BB = I;
+ MachineBasicBlock *BB = &*I;
// Prune unneeded PHI entries.
SmallPtrSet<MachineBasicBlock*, 8> preds(BB->pred_begin(),
BB->pred_end());
DEBUG(MBBI->print(dbgs(), Indexes));
for (MachineBasicBlock::instr_iterator
MII = MBBI->instr_begin(), MIE = MBBI->instr_end(); MII != MIE;) {
- MachineInstr *MI = MII;
+ MachineInstr *MI = &*MII;
++MII;
for (MachineInstr::mop_iterator MOI = MI->operands_begin(),
void WinEHPrepare::findCXXEHReturnPoints(
Function &F, SetVector<BasicBlock *> &EHReturnBlocks) {
for (auto BBI = F.begin(), BBE = F.end(); BBI != BBE; ++BBI) {
- BasicBlock *BB = BBI;
+ BasicBlock *BB = &*BBI;
for (Instruction &I : *BB) {
if (match(&I, m_Intrinsic<Intrinsic::eh_begincatch>())) {
Instruction *SplitPt =
isa<PHINode>(Br->getSuccessor(0)->begin())) {
DEBUG(dbgs() << "splitting block " << BB->getName()
<< " with llvm.eh.endcatch\n");
- BBI = SplitBlock(BB, I.getNextNode(), DT);
+ BBI = SplitBlock(BB, I.getNextNode(), DT)->getIterator();
}
// The next BB is normal control flow.
EHReturnBlocks.insert(BB->getTerminator()->getSuccessor(0));
void WinEHPrepare::findSEHEHReturnPoints(
Function &F, SetVector<BasicBlock *> &EHReturnBlocks) {
for (auto BBI = F.begin(), BBE = F.end(); BBI != BBE; ++BBI) {
- BasicBlock *BB = BBI;
+ BasicBlock *BB = &*BBI;
// If the landingpad is a catch-all, treat the whole lpad as if it is
// reachable from normal control flow.
// FIXME: This is imprecise. We need a better way of identifying where a
if (!CatchHandler->getSinglePredecessor()) {
DEBUG(dbgs() << "splitting EH return edge from " << BB->getName()
<< " to " << CatchHandler->getName() << '\n');
- BBI = CatchHandler = SplitCriticalEdge(
+ CatchHandler = SplitCriticalEdge(
BB, std::find(succ_begin(BB), succ_end(BB), CatchHandler));
+ BBI = CatchHandler->getIterator();
}
EHReturnBlocks.insert(CatchHandler);
}
// FIXME: This demotion is inefficient. We should insert spills at the point
// of definition, insert one reload in each handler that uses the value, and
// insert reloads in the BB used to rejoin normal control flow.
- Instruction *AllocaInsertPt = F.getEntryBlock().getFirstInsertionPt();
+ Instruction *AllocaInsertPt = &*F.getEntryBlock().getFirstInsertionPt();
for (Instruction *I : InstrsToDemote)
DemoteRegToStack(*I, false, AllocaInsertPt);
// FIXME: Switch the ehptr type to i32 and then switch this.
SEHExceptionCodeSlot =
new AllocaInst(Int8PtrType, nullptr, "seh_exception_code",
- F.getEntryBlock().getFirstInsertionPt());
+ &*F.getEntryBlock().getFirstInsertionPt());
}
// In order to handle the case where one outlined catch handler returns
BasicBlock *Entry = &F.getEntryBlock();
IRBuilder<> Builder(F.getParent()->getContext());
- Builder.SetInsertPoint(Entry->getFirstInsertionPt());
+ Builder.SetInsertPoint(Entry, Entry->getFirstInsertionPt());
Function *FrameEscapeFn =
Intrinsic::getDeclaration(M, Intrinsic::localescape);
// and remap return instructions in the nested handlers that should return
// to an address in the outlined handler.
Function *OutlinedHandlerFn = OutlinedBB->getParent();
- BasicBlock::const_iterator II = OriginalLPad;
+ BasicBlock::const_iterator II = OriginalLPad->getIterator();
++II;
// The instruction after the landing pad should now be a call to eh.actions.
- const Instruction *Recover = II;
+ const Instruction *Recover = &*II;
const IntrinsicInst *EHActions = cast<IntrinsicInst>(Recover);
// Remap the return target in the nested handler.
}
static bool isCatchBlock(BasicBlock *BB) {
- for (BasicBlock::iterator II = BB->getFirstNonPHIOrDbg(), IE = BB->end();
+ for (BasicBlock::iterator II = BB->getFirstNonPHIOrDbg()->getIterator(),
+ IE = BB->end();
II != IE; ++II) {
if (match(cast<Value>(II), m_Intrinsic<Intrinsic::eh_begincatch>()))
return true;
// Skip over PHIs and, if applicable, landingpad instructions.
II = StartBB->getFirstInsertionPt();
- CloneAndPruneIntoFromInst(Handler, SrcFn, II, VMap,
+ CloneAndPruneIntoFromInst(Handler, SrcFn, &*II, VMap,
/*ModuleLevelChanges=*/false, Returns, "",
&OutlinedFunctionInfo, Director.get());
// predecessors. Any other block wouldn't have been cloned if it didn't
// have a predecessor which was also cloned.
Function::iterator ClonedIt = std::next(Function::iterator(Entry));
- while (!pred_empty(ClonedIt))
+ while (!pred_empty(&*ClonedIt))
++ClonedIt;
- BasicBlock *ClonedEntryBB = ClonedIt;
- assert(ClonedEntryBB);
+ assert(ClonedIt != Entry->getParent()->end());
+ BasicBlock *ClonedEntryBB = &*ClonedIt;
Entry->getInstList().splice(Entry->end(), ClonedEntryBB->getInstList());
ClonedEntryBB->eraseFromParent();
auto *Branch = dyn_cast<BranchInst>(Pred->getTerminator());
if (!Branch || !Branch->isUnconditional() || Pred->size() <= 1)
continue;
- BasicBlock::iterator II = const_cast<BranchInst *>(Branch);
+ BasicBlock::iterator II =
+ const_cast<BranchInst *>(Branch)->getIterator();
--II;
if (match(cast<Value>(II), m_Intrinsic<Intrinsic::eh_endcatch>())) {
// This would indicate that a nested landing pad wants to return
} else {
// This must be a catch-all. Split the block after the landingpad.
assert(CatchAction->getSelector()->isNullValue() && "expected catch-all");
- HandlerBB = SplitBlock(StartBB, StartBB->getFirstInsertionPt(), DT);
+ HandlerBB = SplitBlock(StartBB, &*StartBB->getFirstInsertionPt(), DT);
}
- IRBuilder<> Builder(HandlerBB->getFirstInsertionPt());
+ IRBuilder<> Builder(&*HandlerBB->getFirstInsertionPt());
Function *EHCodeFn = Intrinsic::getDeclaration(
StartBB->getParent()->getParent(), Intrinsic::eh_exceptioncode_old);
Value *Code = Builder.CreateCall(EHCodeFn, {}, "sehcode");
// New allocas should be inserted in the entry block, but after the parent FP
// is established if it is an instruction.
- Instruction *InsertPoint = EntryBB->getFirstInsertionPt();
+ BasicBlock::iterator InsertPoint = EntryBB->getFirstInsertionPt();
if (auto *FPInst = dyn_cast<Instruction>(ParentFP))
- InsertPoint = FPInst->getNextNode();
+ InsertPoint = std::next(FPInst->getIterator());
Builder.SetInsertPoint(EntryBB, InsertPoint);
}
if (!Insert1)
return createCleanupHandler(Actions, CleanupHandlerMap, BB);
}
- for (BasicBlock::iterator II = BB->getFirstNonPHIOrDbg(), IE = BB->end();
+ for (BasicBlock::iterator II = BB->getFirstNonPHIOrDbg()->getIterator(),
+ IE = BB->end();
II != IE; ++II) {
- Instruction *Inst = II;
+ Instruction *Inst = &*II;
if (LPadMap && LPadMap->isLandingPadSpecificInst(Inst))
continue;
if (Inst == Insert1 || Inst == Insert2 || Inst == Resume)
CmpInst *Compare = dyn_cast<CmpInst>(Branch->getCondition());
if (!Compare || !Compare->isEquality())
return createCleanupHandler(Actions, CleanupHandlerMap, BB);
- for (BasicBlock::iterator II = BB->getFirstNonPHIOrDbg(), IE = BB->end();
+ for (BasicBlock::iterator II = BB->getFirstNonPHIOrDbg()->getIterator(),
+ IE = BB->end();
II != IE; ++II) {
- Instruction *Inst = II;
+ Instruction *Inst = &*II;
if (LPadMap && LPadMap->isLandingPadSpecificInst(Inst))
continue;
if (Inst == Compare || Inst == Branch)
}
// Anything else is either a catch block or interesting cleanup code.
- for (BasicBlock::iterator II = BB->getFirstNonPHIOrDbg(), IE = BB->end();
+ for (BasicBlock::iterator II = BB->getFirstNonPHIOrDbg()->getIterator(),
+ IE = BB->end();
II != IE; ++II) {
- Instruction *Inst = II;
+ Instruction *Inst = &*II;
if (LPadMap && LPadMap->isLandingPadSpecificInst(Inst))
continue;
// Unconditional branches fall through to this loop.
// Strip PHI nodes off of EH pads.
SmallVector<PHINode *, 16> PHINodes;
for (Function::iterator FI = F.begin(), FE = F.end(); FI != FE;) {
- BasicBlock *BB = FI++;
+ BasicBlock *BB = &*FI++;
if (!BB->isEHPad())
continue;
for (BasicBlock::iterator BI = BB->begin(), BE = BB->end(); BI != BE;) {
- Instruction *I = BI++;
+ Instruction *I = &*BI++;
auto *PN = dyn_cast<PHINode>(I);
// Stop at the first non-PHI.
if (!PN)
void WinEHPrepare::demoteUsesBetweenFunclets(Function &F) {
// Turn all inter-funclet uses of a Value into loads and stores.
for (Function::iterator FI = F.begin(), FE = F.end(); FI != FE;) {
- BasicBlock *BB = FI++;
+ BasicBlock *BB = &*FI++;
std::set<BasicBlock *> &ColorsForBB = BlockColors[BB];
for (BasicBlock::iterator BI = BB->begin(), BE = BB->end(); BI != BE;) {
- Instruction *I = BI++;
+ Instruction *I = &*BI++;
// Funclets are permitted to use static allocas.
if (auto *AI = dyn_cast<AllocaInst>(I))
if (AI->isStaticAlloca())
// Clean-up some of the mess we made by removing useles PHI nodes, trivial
// branches, etc.
for (Function::iterator FI = F.begin(), FE = F.end(); FI != FE;) {
- BasicBlock *BB = FI++;
+ BasicBlock *BB = &*FI++;
SimplifyInstructionsInBlock(BB);
ConstantFoldTerminator(BB, /*DeleteDeadConditions=*/true);
MergeBlockIntoPredecessor(BB);
// Insert a load in place of the PHI and replace all uses.
SpillSlot = new AllocaInst(PN->getType(), nullptr,
Twine(PN->getName(), ".wineh.spillslot"),
- F.getEntryBlock().begin());
+ &F.getEntryBlock().front());
Value *V = new LoadInst(SpillSlot, Twine(PN->getName(), ".wineh.reload"),
- PHIBlock->getFirstInsertionPt());
+ &*PHIBlock->getFirstInsertionPt());
PN->replaceAllUsesWith(V);
return SpillSlot;
}
// because we can't insert the store AFTER the terminator instruction.
BasicBlock::iterator InsertPt;
if (isa<Argument>(V)) {
- InsertPt = F.getEntryBlock().getTerminator();
+ InsertPt = F.getEntryBlock().getTerminator()->getIterator();
} else if (isa<TerminatorInst>(V)) {
auto *II = cast<InvokeInst>(V);
// We cannot demote invoke instructions to the stack if their normal
}
InsertPt = II->getNormalDest()->getFirstInsertionPt();
} else {
- InsertPt = cast<Instruction>(V);
+ InsertPt = cast<Instruction>(V)->getIterator();
++InsertPt;
// Don't insert before PHI nodes or EH pad instrs.
for (; isa<PHINode>(InsertPt) || InsertPt->isEHPad(); ++InsertPt)
;
}
- new StoreInst(V, SpillSlot, InsertPt);
+ new StoreInst(V, SpillSlot, &*InsertPt);
}
}
if (!SpillSlot)
SpillSlot = new AllocaInst(V->getType(), nullptr,
Twine(V->getName(), ".wineh.spillslot"),
- F.getEntryBlock().begin());
+ &F.getEntryBlock().front());
auto *UsingInst = cast<Instruction>(U.getUser());
if (auto *UsingPHI = dyn_cast<PHINode>(UsingInst)) {