@@ -1818,7 +1818,7 @@ bool BranchFolder::OptimizeBlock(MachineBasicBlock *MBB) {
18181818bool BranchFolder::HoistCommonCode (MachineFunction &MF) {
18191819 bool MadeChange = false ;
18201820 for (MachineBasicBlock &MBB : llvm::make_early_inc_range (MF))
1821- MadeChange |= HoistCommonCodeInSuccs (&MBB, MF );
1821+ MadeChange |= HoistCommonCodeInSuccs (&MBB);
18221822
18231823 return MadeChange;
18241824}
@@ -1948,8 +1948,7 @@ MachineBasicBlock::iterator findHoistingInsertPosAndDeps(MachineBasicBlock *MBB,
19481948 return PI;
19491949}
19501950
1951- bool BranchFolder::HoistCommonCodeInSuccs (MachineBasicBlock *MBB,
1952- MachineFunction &MF) {
1951+ bool BranchFolder::HoistCommonCodeInSuccs (MachineBasicBlock *MBB) {
19531952 MachineBasicBlock *TBB = nullptr , *FBB = nullptr ;
19541953 SmallVector<MachineOperand, 4 > Cond;
19551954 if (TII->analyzeBranch (*MBB, TBB, FBB, Cond, true ) || !TBB || Cond.empty ())
@@ -1980,6 +1979,7 @@ bool BranchFolder::HoistCommonCodeInSuccs(MachineBasicBlock *MBB,
19801979 MachineBasicBlock::iterator FIB = FBB->begin ();
19811980 MachineBasicBlock::iterator TIE = TBB->end ();
19821981 MachineBasicBlock::iterator FIE = FBB->end ();
1982+ MachineFunction &MF = *MBB->getParent ();
19831983 while (TIB != TIE && FIB != FIE) {
19841984 // Skip dbg_value instructions. These do not count.
19851985 TIB = skipDebugInstructionsForward (TIB, TIE, false );
0 commit comments