File tree Expand file tree Collapse file tree 1 file changed +3
-12
lines changed Expand file tree Collapse file tree 1 file changed +3
-12
lines changed Original file line number Diff line number Diff line change @@ -688,21 +688,15 @@ bool BPFMIPreEmitPeephole::insertMissingCallerSavedSpills() {
688688bool BPFMIPreEmitPeephole::removeMayGotoZero () {
689689 bool Changed = false ;
690690 MachineBasicBlock *Prev_MBB, *Curr_MBB = nullptr ;
691- MachineBasicBlock *ToErase = nullptr ;
692-
693- for (MachineBasicBlock &MBB : reverse (*MF)) {
694- if (ToErase) {
695- ToErase->eraseFromParent ();
696- ToErase = nullptr ;
697- }
698691
692+ for (MachineBasicBlock &MBB : make_early_inc_range (reverse (*MF))) {
699693 Prev_MBB = Curr_MBB;
700694 Curr_MBB = &MBB;
701695 if (Prev_MBB == nullptr )
702696 continue ;
703697
704698 MachineInstr &MI = MBB.back ();
705- if (! MI.isInlineAsm () )
699+ if (MI.getOpcode () != TargetOpcode::INLINEASM_BR )
706700 continue ;
707701
708702 const char *AsmStr = MI.getOperand (0 ).getSymbolName ();
@@ -727,20 +721,17 @@ bool BPFMIPreEmitPeephole::removeMayGotoZero() {
727721 Changed = true ;
728722 if (MBB.begin () == MI) {
729723 // Single 'may_goto' insn in the same basic block.
730- ToErase = Curr_MBB;
731724 Curr_MBB->removeSuccessor (Prev_MBB);
732725 for (MachineBasicBlock *Pred : Curr_MBB->predecessors ())
733726 Pred->replaceSuccessor (Curr_MBB, Prev_MBB);
727+ Curr_MBB->eraseFromParent ();
734728 Curr_MBB = Prev_MBB;
735729 } else {
736730 // Remove 'may_goto' insn.
737731 MI.eraseFromParent ();
738732 }
739733 }
740734
741- if (ToErase)
742- ToErase->eraseFromParent ();
743-
744735 return Changed;
745736}
746737
You can’t perform that action at this time.
0 commit comments