@@ -280,10 +280,16 @@ BasicBlock *ehAwareSplitEdge(BasicBlock *BB, BasicBlock *Succ,
280
280
// / branch. The new block with name \p BBName is returned.
281
281
// /
282
282
// / FIXME: deprecated, switch to the DomTreeUpdater-based one.
283
- BasicBlock *SplitBlock (BasicBlock *Old, Instruction * SplitPt, DominatorTree *DT,
283
+ BasicBlock *SplitBlock (BasicBlock *Old, BasicBlock::iterator SplitPt, DominatorTree *DT,
284
284
LoopInfo *LI = nullptr ,
285
285
MemorySSAUpdater *MSSAU = nullptr ,
286
286
const Twine &BBName = " " , bool Before = false );
287
+ inline BasicBlock *SplitBlock (BasicBlock *Old, Instruction *SplitPt, DominatorTree *DT,
288
+ LoopInfo *LI = nullptr ,
289
+ MemorySSAUpdater *MSSAU = nullptr ,
290
+ const Twine &BBName = " " , bool Before = false ) {
291
+ return SplitBlock (Old, SplitPt->getIterator (), DT, LI, MSSAU, BBName, Before);
292
+ }
287
293
288
294
// / Split the specified block at the specified instruction.
289
295
// /
@@ -293,19 +299,30 @@ BasicBlock *SplitBlock(BasicBlock *Old, Instruction *SplitPt, DominatorTree *DT,
293
299
// / Everything before \p SplitPt stays in \p Old and everything starting with \p
294
300
// / SplitPt moves to a new block. The two blocks are joined by an unconditional
295
301
// / branch. The new block with name \p BBName is returned.
296
- BasicBlock *SplitBlock (BasicBlock *Old, Instruction * SplitPt,
302
+ BasicBlock *SplitBlock (BasicBlock *Old, BasicBlock::iterator SplitPt,
297
303
DomTreeUpdater *DTU = nullptr , LoopInfo *LI = nullptr ,
298
304
MemorySSAUpdater *MSSAU = nullptr ,
299
305
const Twine &BBName = " " , bool Before = false );
306
+ inline BasicBlock *SplitBlock (BasicBlock *Old, Instruction *SplitPt,
307
+ DomTreeUpdater *DTU = nullptr , LoopInfo *LI = nullptr ,
308
+ MemorySSAUpdater *MSSAU = nullptr ,
309
+ const Twine &BBName = " " , bool Before = false ) {
310
+ return SplitBlock (Old, SplitPt->getIterator (), DTU, LI, MSSAU, BBName, Before);
311
+ }
300
312
301
313
// / Split the specified block at the specified instruction \p SplitPt.
302
314
// / All instructions before \p SplitPt are moved to a new block and all
303
315
// / instructions after \p SplitPt stay in the old block. The new block and the
304
316
// / old block are joined by inserting an unconditional branch to the end of the
305
317
// / new block. The new block with name \p BBName is returned.
306
- BasicBlock *splitBlockBefore (BasicBlock *Old, Instruction * SplitPt,
318
+ BasicBlock *splitBlockBefore (BasicBlock *Old, BasicBlock::iterator SplitPt,
307
319
DomTreeUpdater *DTU, LoopInfo *LI,
308
320
MemorySSAUpdater *MSSAU, const Twine &BBName = " " );
321
+ inline BasicBlock *splitBlockBefore (BasicBlock *Old, Instruction *SplitPt,
322
+ DomTreeUpdater *DTU, LoopInfo *LI,
323
+ MemorySSAUpdater *MSSAU, const Twine &BBName = " " ) {
324
+ return splitBlockBefore (Old, SplitPt->getIterator (), DTU, LI, MSSAU, BBName);
325
+ }
309
326
310
327
// / This method introduces at least one new basic block into the function and
311
328
// / moves some of the predecessors of BB to be predecessors of the new block.
@@ -417,22 +434,44 @@ ReturnInst *FoldReturnIntoUncondBranch(ReturnInst *RI, BasicBlock *BB,
417
434
// / Returns the NewBasicBlock's terminator.
418
435
// /
419
436
// / Updates DTU and LI if given.
420
- Instruction *SplitBlockAndInsertIfThen (Value *Cond, Instruction * SplitBefore,
437
+ Instruction *SplitBlockAndInsertIfThen (Value *Cond, BasicBlock::iterator SplitBefore,
421
438
bool Unreachable,
422
439
MDNode *BranchWeights = nullptr ,
423
440
DomTreeUpdater *DTU = nullptr ,
424
441
LoopInfo *LI = nullptr ,
425
442
BasicBlock *ThenBlock = nullptr );
426
443
444
+ inline Instruction *SplitBlockAndInsertIfThen (Value *Cond, Instruction *SplitBefore,
445
+ bool Unreachable,
446
+ MDNode *BranchWeights = nullptr ,
447
+ DomTreeUpdater *DTU = nullptr ,
448
+ LoopInfo *LI = nullptr ,
449
+ BasicBlock *ThenBlock = nullptr ) {
450
+ return SplitBlockAndInsertIfThen (Cond, SplitBefore->getIterator (),
451
+ Unreachable, BranchWeights, DTU, LI,
452
+ ThenBlock);
453
+ }
454
+
427
455
// / Similar to SplitBlockAndInsertIfThen, but the inserted block is on the false
428
456
// / path of the branch.
429
- Instruction *SplitBlockAndInsertIfElse (Value *Cond, Instruction * SplitBefore,
457
+ Instruction *SplitBlockAndInsertIfElse (Value *Cond, BasicBlock::iterator SplitBefore,
430
458
bool Unreachable,
431
459
MDNode *BranchWeights = nullptr ,
432
460
DomTreeUpdater *DTU = nullptr ,
433
461
LoopInfo *LI = nullptr ,
434
462
BasicBlock *ElseBlock = nullptr );
435
463
464
+ inline Instruction *SplitBlockAndInsertIfElse (Value *Cond, Instruction *SplitBefore,
465
+ bool Unreachable,
466
+ MDNode *BranchWeights = nullptr ,
467
+ DomTreeUpdater *DTU = nullptr ,
468
+ LoopInfo *LI = nullptr ,
469
+ BasicBlock *ElseBlock = nullptr ) {
470
+ return SplitBlockAndInsertIfElse (Cond, SplitBefore->getIterator (),
471
+ Unreachable, BranchWeights, DTU, LI,
472
+ ElseBlock);
473
+ }
474
+
436
475
// / SplitBlockAndInsertIfThenElse is similar to SplitBlockAndInsertIfThen,
437
476
// / but also creates the ElseBlock.
438
477
// / Before:
@@ -449,13 +488,25 @@ Instruction *SplitBlockAndInsertIfElse(Value *Cond, Instruction *SplitBefore,
449
488
// / Tail
450
489
// /
451
490
// / Updates DT if given.
452
- void SplitBlockAndInsertIfThenElse (Value *Cond, Instruction *SplitBefore,
491
+ void SplitBlockAndInsertIfThenElse (Value *Cond,
492
+ BasicBlock::iterator SplitBefore,
453
493
Instruction **ThenTerm,
454
494
Instruction **ElseTerm,
455
495
MDNode *BranchWeights = nullptr ,
456
496
DomTreeUpdater *DTU = nullptr ,
457
497
LoopInfo *LI = nullptr );
458
498
499
+ inline void SplitBlockAndInsertIfThenElse (Value *Cond, Instruction *SplitBefore,
500
+ Instruction **ThenTerm,
501
+ Instruction **ElseTerm,
502
+ MDNode *BranchWeights = nullptr ,
503
+ DomTreeUpdater *DTU = nullptr ,
504
+ LoopInfo *LI = nullptr )
505
+ {
506
+ SplitBlockAndInsertIfThenElse (Cond, SplitBefore->getIterator (), ThenTerm,
507
+ ElseTerm, BranchWeights, DTU, LI);
508
+ }
509
+
459
510
// / Split the containing block at the specified instruction - everything before
460
511
// / SplitBefore stays in the old basic block, and the rest of the instructions
461
512
// / in the BB are moved to a new block. The two blocks are connected by a
@@ -483,7 +534,8 @@ void SplitBlockAndInsertIfThenElse(Value *Cond, Instruction *SplitBefore,
483
534
// / caller must ensure that Tail is reachable from Head.
484
535
// / Returns the newly created blocks in \p ThenBlock and \p ElseBlock.
485
536
// / Updates DTU and LI if given.
486
- void SplitBlockAndInsertIfThenElse (Value *Cond, Instruction *SplitBefore,
537
+ void SplitBlockAndInsertIfThenElse (Value *Cond,
538
+ BasicBlock::iterator SplitBefore,
487
539
BasicBlock **ThenBlock,
488
540
BasicBlock **ElseBlock,
489
541
bool UnreachableThen = false ,
@@ -492,6 +544,18 @@ void SplitBlockAndInsertIfThenElse(Value *Cond, Instruction *SplitBefore,
492
544
DomTreeUpdater *DTU = nullptr ,
493
545
LoopInfo *LI = nullptr );
494
546
547
+ inline void SplitBlockAndInsertIfThenElse (Value *Cond, Instruction *SplitBefore,
548
+ BasicBlock **ThenBlock,
549
+ BasicBlock **ElseBlock,
550
+ bool UnreachableThen = false ,
551
+ bool UnreachableElse = false ,
552
+ MDNode *BranchWeights = nullptr ,
553
+ DomTreeUpdater *DTU = nullptr ,
554
+ LoopInfo *LI = nullptr ) {
555
+ SplitBlockAndInsertIfThenElse (Cond, SplitBefore->getIterator (), ThenBlock,
556
+ ElseBlock, UnreachableThen, UnreachableElse, BranchWeights, DTU, LI);
557
+ }
558
+
495
559
// / Insert a for (int i = 0; i < End; i++) loop structure (with the exception
496
560
// / that \p End is assumed > 0, and thus not checked on entry) at \p
497
561
// / SplitBefore. Returns the first insert point in the loop body, and the
0 commit comments