@@ -377,29 +377,29 @@ bool LoopRotate::rotateLoop(Loop *L, bool SimplifiedLatch) {
377377 Metrics.analyzeBasicBlock (OrigHeader, *TTI, EphValues, PrepareForLTO);
378378 if (Metrics.notDuplicatable ) {
379379 LLVM_DEBUG (
380- dbgs () << " LoopRotation: NOT rotating - contains non-duplicatable"
381- << " instructions: " ;
382- L->dump ());
380+ dbgs () << " LoopRotation: NOT rotating - contains non-duplicatable"
381+ << " instructions: " ;
382+ L->dump ());
383383 return Rotated;
384384 }
385385 if (Metrics.Convergence != ConvergenceKind::None) {
386386 LLVM_DEBUG (dbgs () << " LoopRotation: NOT rotating - contains convergent "
387- " instructions: " ;
388- L->dump ());
387+ " instructions: " ;
388+ L->dump ());
389389 return Rotated;
390390 }
391391 if (!Metrics.NumInsts .isValid ()) {
392392 LLVM_DEBUG (dbgs () << " LoopRotation: NOT rotating - contains instructions"
393- " with invalid cost: " ;
394- L->dump ());
393+ " with invalid cost: " ;
394+ L->dump ());
395395 return Rotated;
396396 }
397397 if (Metrics.NumInsts > MaxHeaderSize) {
398398 LLVM_DEBUG (dbgs () << " LoopRotation: NOT rotating - contains "
399399 << Metrics.NumInsts
400400 << " instructions, which is more than the threshold ("
401401 << MaxHeaderSize << " instructions): " ;
402- L->dump ());
402+ L->dump ());
403403 ++NumNotRotatedDueToHeaderSize;
404404 return Rotated;
405405 }
@@ -446,12 +446,12 @@ bool LoopRotate::rotateLoop(Loop *L, bool SimplifiedLatch) {
446446 std::swap (Exit, NewHeader);
447447 assert (NewHeader && " Unable to determine new loop header" );
448448 assert (L->contains (NewHeader) && !L->contains (Exit) &&
449- " Unable to determine loop header and exit blocks" );
449+ " Unable to determine loop header and exit blocks" );
450450
451451 // This code assumes that the new header has exactly one predecessor.
452452 // Remove any single-entry PHI nodes in it.
453453 assert (NewHeader->getSinglePredecessor () &&
454- " New header doesn't have one pred!" );
454+ " New header doesn't have one pred!" );
455455 FoldSingleEntryPHINodes (NewHeader);
456456
457457 // Begin by walking OrigHeader and populating ValueMap with an entry for
@@ -483,7 +483,7 @@ bool LoopRotate::rotateLoop(Loop *L, bool SimplifiedLatch) {
483483 // Build DbgVariableRecord hashes for DbgVariableRecords attached to the
484484 // terminator.
485485 for (const DbgVariableRecord &DVR :
486- filterDbgVars (OrigPreheader->getTerminator ()->getDbgRecordRange ()))
486+ filterDbgVars (OrigPreheader->getTerminator ()->getDbgRecordRange ()))
487487 DbgRecords.insert (makeHash (&DVR));
488488
489489 // Remember the local noalias scope declarations in the header. After the
@@ -549,7 +549,7 @@ bool LoopRotate::rotateLoop(Loop *L, bool SimplifiedLatch) {
549549 RF_NoModuleLevelChanges | RF_IgnoreMissingLocals);
550550 // Erase anything we've seen before.
551551 for (DbgVariableRecord &DVR :
552- make_early_inc_range (filterDbgVars (DbgValueRange)))
552+ make_early_inc_range (filterDbgVars (DbgValueRange)))
553553 if (DbgRecords.count (makeHash (&DVR)))
554554 DVR.eraseFromParent ();
555555 }
@@ -577,15 +577,14 @@ bool LoopRotate::rotateLoop(Loop *L, bool SimplifiedLatch) {
577577 RF_NoModuleLevelChanges | RF_IgnoreMissingLocals);
578578 NextDbgInsts = DbgMarker::getEmptyDbgRecordRange ();
579579 // Erase anything we've seen before.
580- for (DbgVariableRecord &DVR :
581- make_early_inc_range (filterDbgVars (Range)))
580+ for (DbgVariableRecord &DVR : make_early_inc_range (filterDbgVars (Range)))
582581 if (DbgRecords.count (makeHash (&DVR)))
583582 DVR.eraseFromParent ();
584583 }
585584
586585 // Eagerly remap the operands of the instruction.
587586 RemapInstruction (C, ValueMap,
588- RF_NoModuleLevelChanges | RF_IgnoreMissingLocals);
587+ RF_NoModuleLevelChanges | RF_IgnoreMissingLocals);
589588
590589 // With the operands remapped, see if the instruction constant folds or is
591590 // otherwise simplifyable. This commonly occurs because the entry from PHI
@@ -658,7 +657,7 @@ bool LoopRotate::rotateLoop(Loop *L, bool SimplifiedLatch) {
658657
659658 LLVM_DEBUG (dbgs () << " Updating OrigHeader scopes\n " );
660659 cloneAndAdaptNoAliasScopes (NoAliasDeclScopes, {OrigHeader}, Context,
661- " h.rot" );
660+ " h.rot" );
662661 LLVM_DEBUG (OrigHeader->dump ());
663662
664663 // Keep the compile time impact low by only adapting the inserted block
@@ -671,7 +670,7 @@ bool LoopRotate::rotateLoop(Loop *L, bool SimplifiedLatch) {
671670 cast<Instruction>(ValueMap[*NoAliasDeclInstructions.begin ()]);
672671 auto *LastInst = &OrigPreheader->back ();
673672 cloneAndAdaptNoAliasScopes (NoAliasDeclScopes, FirstDecl, LastInst,
674- Context, " pre.rot" );
673+ Context, " pre.rot" );
675674 LLVM_DEBUG (OrigPreheader->dump ());
676675
677676 LLVM_DEBUG (dbgs () << " Updated NewHeader:\n " );
@@ -684,7 +683,7 @@ bool LoopRotate::rotateLoop(Loop *L, bool SimplifiedLatch) {
684683 // successors by duplicating their incoming values for OrigHeader.
685684 for (BasicBlock *SuccBB : successors (OrigHeader))
686685 for (BasicBlock::iterator BI = SuccBB->begin ();
687- PHINode *PN = dyn_cast<PHINode>(BI); ++BI)
686+ PHINode *PN = dyn_cast<PHINode>(BI); ++BI)
688687 PN->addIncoming (PN->getIncomingValueForBlock (OrigHeader), OrigPreheader);
689688
690689 // Now that OrigPreHeader has a clone of OrigHeader's terminator, remove
@@ -701,7 +700,7 @@ bool LoopRotate::rotateLoop(Loop *L, bool SimplifiedLatch) {
701700 ValueMapMSSA);
702701 }
703702
704- SmallVector<PHINode*, 2 > InsertedPHIs;
703+ SmallVector<PHINode *, 2 > InsertedPHIs;
705704 // If there were any uses of instructions in the duplicated block outside the
706705 // loop, update them, inserting PHI nodes as required
707706 RewriteUsesOfClonedInstructions (OrigHeader, OrigPreheader, ValueMap, SE,
@@ -759,8 +758,8 @@ bool LoopRotate::rotateLoop(Loop *L, bool SimplifiedLatch) {
759758 // thus is not a preheader anymore.
760759 // Split the edge to form a real preheader.
761760 BasicBlock *NewPH = SplitCriticalEdge (
762- OrigPreheader, NewHeader,
763- CriticalEdgeSplittingOptions (DT, LI, MSSAU).setPreserveLCSSA ());
761+ OrigPreheader, NewHeader,
762+ CriticalEdgeSplittingOptions (DT, LI, MSSAU).setPreserveLCSSA ());
764763 NewPH->setName (NewHeader->getName () + " .lr.ph" );
765764
766765 // Preserve canonical loop form, which means that 'Exit' should have only
@@ -777,12 +776,12 @@ bool LoopRotate::rotateLoop(Loop *L, bool SimplifiedLatch) {
777776 continue ;
778777 SplitLatchEdge |= L->getLoopLatch () == ExitPred;
779778 BasicBlock *ExitSplit = SplitCriticalEdge (
780- ExitPred, Exit,
781- CriticalEdgeSplittingOptions (DT, LI, MSSAU).setPreserveLCSSA ());
779+ ExitPred, Exit,
780+ CriticalEdgeSplittingOptions (DT, LI, MSSAU).setPreserveLCSSA ());
782781 ExitSplit->moveBefore (Exit);
783782 }
784783 assert (SplitLatchEdge &&
785- " Despite splitting all preds, failed to split latch exit?" );
784+ " Despite splitting all preds, failed to split latch exit?" );
786785 (void )SplitLatchEdge;
787786 } else {
788787 // We can fold the conditional branch in the preheader, this makes things
@@ -793,7 +792,8 @@ bool LoopRotate::rotateLoop(Loop *L, bool SimplifiedLatch) {
793792 PHBI->eraseFromParent ();
794793
795794 // With our CFG finalized, update DomTree if it is available.
796- if (DT) DT->deleteEdge (OrigPreheader, Exit);
795+ if (DT)
796+ DT->deleteEdge (OrigPreheader, Exit);
797797
798798 // Update MSSA too, if available.
799799 if (MSSAU)
0 commit comments