File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -692,10 +692,10 @@ bool BPFMIPreEmitPeephole::removeMayGotoZero() {
692692 for (MachineBasicBlock &MBB : make_early_inc_range (reverse (*MF))) {
693693 Prev_MBB = Curr_MBB;
694694 Curr_MBB = &MBB;
695- if (Prev_MBB == nullptr )
695+ if (Prev_MBB == nullptr || Curr_MBB-> empty () )
696696 continue ;
697697
698- MachineInstr &MI = MBB. back ();
698+ MachineInstr &MI = Curr_MBB-> back ();
699699 if (MI.getOpcode () != TargetOpcode::INLINEASM_BR)
700700 continue ;
701701
@@ -718,11 +718,11 @@ bool BPFMIPreEmitPeephole::removeMayGotoZero() {
718718
719719 // Get the may_goto branch target.
720720 MachineOperand &MO = MI.getOperand (InlineAsm::MIOp_FirstOperand + 1 );
721- if (MO.getMBB () != Prev_MBB)
721+ if (!MO. isMBB () || MO.getMBB () != Prev_MBB)
722722 continue ;
723723
724724 Changed = true ;
725- if (MBB. begin () == MI) {
725+ if (Curr_MBB-> begin () == MI) {
726726 // Single 'may_goto' insn in the same basic block.
727727 Curr_MBB->removeSuccessor (Prev_MBB);
728728 for (MachineBasicBlock *Pred : Curr_MBB->predecessors ())
You can’t perform that action at this time.
0 commit comments