@@ -2191,7 +2191,7 @@ LSRInstance::OptimizeLoopTermCond() {
2191
2191
ICmpInst *OldCond = Cond;
2192
2192
Cond = cast<ICmpInst>(Cond->clone ());
2193
2193
Cond->setName (L->getHeader ()->getName () + " .termcond" );
2194
- ExitingBlock->getInstList ().insert (TermBr, Cond);
2194
+ ExitingBlock->getInstList ().insert (TermBr-> getIterator () , Cond);
2195
2195
2196
2196
// Clone the IVUse, as the old use still exists!
2197
2197
CondUse = &IU.AddUser (Cond, CondUse->getOperandValToReplace ());
@@ -2765,19 +2765,19 @@ void LSRInstance::CollectChains() {
2765
2765
for (BasicBlock::iterator I = (*BBIter)->begin (), E = (*BBIter)->end ();
2766
2766
I != E; ++I) {
2767
2767
// Skip instructions that weren't seen by IVUsers analysis.
2768
- if (isa<PHINode>(I) || !IU.isIVUserOrOperand (I))
2768
+ if (isa<PHINode>(I) || !IU.isIVUserOrOperand (&* I))
2769
2769
continue ;
2770
2770
2771
2771
// Ignore users that are part of a SCEV expression. This way we only
2772
2772
// consider leaf IV Users. This effectively rediscovers a portion of
2773
2773
// IVUsers analysis but in program order this time.
2774
- if (SE.isSCEVable (I->getType ()) && !isa<SCEVUnknown>(SE.getSCEV (I)))
2774
+ if (SE.isSCEVable (I->getType ()) && !isa<SCEVUnknown>(SE.getSCEV (&* I)))
2775
2775
continue ;
2776
2776
2777
2777
// Remove this instruction from any NearUsers set it may be in.
2778
2778
for (unsigned ChainIdx = 0 , NChains = IVChainVec.size ();
2779
2779
ChainIdx < NChains; ++ChainIdx) {
2780
- ChainUsersVec[ChainIdx].NearUsers .erase (I);
2780
+ ChainUsersVec[ChainIdx].NearUsers .erase (&* I);
2781
2781
}
2782
2782
// Search for operands that can be chained.
2783
2783
SmallPtrSet<Instruction*, 4 > UniqueOperands;
@@ -2786,7 +2786,7 @@ void LSRInstance::CollectChains() {
2786
2786
while (IVOpIter != IVOpEnd) {
2787
2787
Instruction *IVOpInst = cast<Instruction>(*IVOpIter);
2788
2788
if (UniqueOperands.insert (IVOpInst).second )
2789
- ChainInstruction (I, IVOpInst, ChainUsersVec);
2789
+ ChainInstruction (&* I, IVOpInst, ChainUsersVec);
2790
2790
IVOpIter = findIVOperand (std::next (IVOpIter), IVOpEnd, L, SE);
2791
2791
}
2792
2792
} // Continue walking down the instructions.
@@ -4368,14 +4368,14 @@ LSRInstance::HoistInsertPosition(BasicBlock::iterator IP,
4368
4368
// instead of at the end, so that it can be used for other expansions.
4369
4369
if (IDom == Inst->getParent () &&
4370
4370
(!BetterPos || !DT.dominates (Inst, BetterPos)))
4371
- BetterPos = std::next (BasicBlock::iterator (Inst));
4371
+ BetterPos = &* std::next (BasicBlock::iterator (Inst));
4372
4372
}
4373
4373
if (!AllDominate)
4374
4374
break ;
4375
4375
if (BetterPos)
4376
- IP = BetterPos;
4376
+ IP = BetterPos-> getIterator () ;
4377
4377
else
4378
- IP = Tentative;
4378
+ IP = Tentative-> getIterator () ;
4379
4379
}
4380
4380
4381
4381
return IP;
@@ -4440,7 +4440,8 @@ LSRInstance::AdjustInsertPositionForExpand(BasicBlock::iterator LowestIP,
4440
4440
// Set IP below instructions recently inserted by SCEVExpander. This keeps the
4441
4441
// IP consistent across expansions and allows the previously inserted
4442
4442
// instructions to be reused by subsequent expansion.
4443
- while (Rewriter.isInsertedInstruction (IP) && IP != LowestIP) ++IP;
4443
+ while (Rewriter.isInsertedInstruction (&*IP) && IP != LowestIP)
4444
+ ++IP;
4444
4445
4445
4446
return IP;
4446
4447
}
@@ -4490,7 +4491,7 @@ Value *LSRInstance::Expand(const LSRFixup &LF,
4490
4491
LF.UserInst , LF.OperandValToReplace ,
4491
4492
Loops, SE, DT);
4492
4493
4493
- Ops.push_back (SE.getUnknown (Rewriter.expandCodeFor (Reg, nullptr , IP)));
4494
+ Ops.push_back (SE.getUnknown (Rewriter.expandCodeFor (Reg, nullptr , &* IP)));
4494
4495
}
4495
4496
4496
4497
// Expand the ScaledReg portion.
@@ -4508,14 +4509,14 @@ Value *LSRInstance::Expand(const LSRFixup &LF,
4508
4509
// Expand ScaleReg as if it was part of the base regs.
4509
4510
if (F.Scale == 1 )
4510
4511
Ops.push_back (
4511
- SE.getUnknown (Rewriter.expandCodeFor (ScaledS, nullptr , IP)));
4512
+ SE.getUnknown (Rewriter.expandCodeFor (ScaledS, nullptr , &* IP)));
4512
4513
else {
4513
4514
// An interesting way of "folding" with an icmp is to use a negated
4514
4515
// scale, which we'll implement by inserting it into the other operand
4515
4516
// of the icmp.
4516
4517
assert (F.Scale == -1 &&
4517
4518
" The only scale supported by ICmpZero uses is -1!" );
4518
- ICmpScaledV = Rewriter.expandCodeFor (ScaledS, nullptr , IP);
4519
+ ICmpScaledV = Rewriter.expandCodeFor (ScaledS, nullptr , &* IP);
4519
4520
}
4520
4521
} else {
4521
4522
// Otherwise just expand the scaled register and an explicit scale,
@@ -4525,11 +4526,11 @@ Value *LSRInstance::Expand(const LSRFixup &LF,
4525
4526
// Unless the addressing mode will not be folded.
4526
4527
if (!Ops.empty () && LU.Kind == LSRUse::Address &&
4527
4528
isAMCompletelyFolded (TTI, LU, F)) {
4528
- Value *FullV = Rewriter.expandCodeFor (SE.getAddExpr (Ops), Ty, IP);
4529
+ Value *FullV = Rewriter.expandCodeFor (SE.getAddExpr (Ops), Ty, &* IP);
4529
4530
Ops.clear ();
4530
4531
Ops.push_back (SE.getUnknown (FullV));
4531
4532
}
4532
- ScaledS = SE.getUnknown (Rewriter.expandCodeFor (ScaledS, nullptr , IP));
4533
+ ScaledS = SE.getUnknown (Rewriter.expandCodeFor (ScaledS, nullptr , &* IP));
4533
4534
if (F.Scale != 1 )
4534
4535
ScaledS =
4535
4536
SE.getMulExpr (ScaledS, SE.getConstant (ScaledS->getType (), F.Scale ));
@@ -4541,7 +4542,7 @@ Value *LSRInstance::Expand(const LSRFixup &LF,
4541
4542
if (F.BaseGV ) {
4542
4543
// Flush the operand list to suppress SCEVExpander hoisting.
4543
4544
if (!Ops.empty ()) {
4544
- Value *FullV = Rewriter.expandCodeFor (SE.getAddExpr (Ops), Ty, IP);
4545
+ Value *FullV = Rewriter.expandCodeFor (SE.getAddExpr (Ops), Ty, &* IP);
4545
4546
Ops.clear ();
4546
4547
Ops.push_back (SE.getUnknown (FullV));
4547
4548
}
@@ -4551,7 +4552,7 @@ Value *LSRInstance::Expand(const LSRFixup &LF,
4551
4552
// Flush the operand list to suppress SCEVExpander hoisting of both folded and
4552
4553
// unfolded offsets. LSR assumes they both live next to their uses.
4553
4554
if (!Ops.empty ()) {
4554
- Value *FullV = Rewriter.expandCodeFor (SE.getAddExpr (Ops), Ty, IP);
4555
+ Value *FullV = Rewriter.expandCodeFor (SE.getAddExpr (Ops), Ty, &* IP);
4555
4556
Ops.clear ();
4556
4557
Ops.push_back (SE.getUnknown (FullV));
4557
4558
}
@@ -4587,7 +4588,7 @@ Value *LSRInstance::Expand(const LSRFixup &LF,
4587
4588
const SCEV *FullS = Ops.empty () ?
4588
4589
SE.getConstant (IntTy, 0 ) :
4589
4590
SE.getAddExpr (Ops);
4590
- Value *FullV = Rewriter.expandCodeFor (FullS, Ty, IP);
4591
+ Value *FullV = Rewriter.expandCodeFor (FullS, Ty, &* IP);
4591
4592
4592
4593
// We're done expanding now, so reset the rewriter.
4593
4594
Rewriter.clearPostInc ();
@@ -4687,7 +4688,8 @@ void LSRInstance::RewriteForPHI(PHINode *PN,
4687
4688
if (!Pair.second )
4688
4689
PN->setIncomingValue (i, Pair.first ->second );
4689
4690
else {
4690
- Value *FullV = Expand (LF, F, BB->getTerminator (), Rewriter, DeadInsts);
4691
+ Value *FullV = Expand (LF, F, BB->getTerminator ()->getIterator (),
4692
+ Rewriter, DeadInsts);
4691
4693
4692
4694
// If this is reuse-by-noop-cast, insert the noop cast.
4693
4695
Type *OpTy = LF.OperandValToReplace ->getType ();
@@ -4717,7 +4719,8 @@ void LSRInstance::Rewrite(const LSRFixup &LF,
4717
4719
if (PHINode *PN = dyn_cast<PHINode>(LF.UserInst )) {
4718
4720
RewriteForPHI (PN, LF, F, Rewriter, DeadInsts, P);
4719
4721
} else {
4720
- Value *FullV = Expand (LF, F, LF.UserInst , Rewriter, DeadInsts);
4722
+ Value *FullV =
4723
+ Expand (LF, F, LF.UserInst ->getIterator (), Rewriter, DeadInsts);
4721
4724
4722
4725
// If this is reuse-by-noop-cast, insert the noop cast.
4723
4726
Type *OpTy = LF.OperandValToReplace ->getType ();
0 commit comments