Skip to content

Commit 9ef66f3

Browse files
committed
Address zhaoqi's comments
1 parent b25820f commit 9ef66f3

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

llvm/lib/CodeGen/BranchFolding.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1818,7 +1818,7 @@ bool BranchFolder::OptimizeBlock(MachineBasicBlock *MBB) {
18181818
bool 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);

llvm/lib/CodeGen/BranchFolding.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ class TargetRegisterInfo;
196196

197197
/// If the successors of MBB has common instruction sequence at the start of
198198
/// the function, move the instructions before MBB terminator if it's legal.
199-
bool HoistCommonCodeInSuccs(MachineBasicBlock *MBB, MachineFunction &MF);
199+
bool HoistCommonCodeInSuccs(MachineBasicBlock *MBB);
200200
};
201201

202202
} // end namespace llvm

0 commit comments

Comments
 (0)