diff options
Diffstat (limited to 'llvm/lib/CodeGen/BranchFolding.cpp')
-rw-r--r-- | llvm/lib/CodeGen/BranchFolding.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/llvm/lib/CodeGen/BranchFolding.cpp b/llvm/lib/CodeGen/BranchFolding.cpp index fd3f465fb390..65e7e92fe152 100644 --- a/llvm/lib/CodeGen/BranchFolding.cpp +++ b/llvm/lib/CodeGen/BranchFolding.cpp @@ -164,10 +164,10 @@ void BranchFolder::RemoveDeadBlock(MachineBasicBlock *MBB) { TriedMerging.erase(MBB); // Update call site info. - std::for_each(MBB->begin(), MBB->end(), [MF](const MachineInstr &MI) { + for (const MachineInstr &MI : *MBB) if (MI.shouldUpdateCallSiteInfo()) MF->eraseCallSiteInfo(&MI); - }); + // Remove the block. MF->erase(MBB); EHScopeMembership.erase(MBB); @@ -286,7 +286,7 @@ static unsigned HashMachineInstr(const MachineInstr &MI) { /// HashEndOfMBB - Hash the last instruction in the MBB. static unsigned HashEndOfMBB(const MachineBasicBlock &MBB) { - MachineBasicBlock::const_iterator I = MBB.getLastNonDebugInstr(); + MachineBasicBlock::const_iterator I = MBB.getLastNonDebugInstr(false); if (I == MBB.end()) return 0; @@ -566,9 +566,9 @@ ProfitableToMerge(MachineBasicBlock *MBB1, MachineBasicBlock *MBB2, // Move the iterators to the beginning of the MBB if we only got debug // instructions before the tail. This is to avoid splitting a block when we // only got debug instructions before the tail (to be invariant on -g). - if (skipDebugInstructionsForward(MBB1->begin(), MBB1->end()) == I1) + if (skipDebugInstructionsForward(MBB1->begin(), MBB1->end(), false) == I1) I1 = MBB1->begin(); - if (skipDebugInstructionsForward(MBB2->begin(), MBB2->end()) == I2) + if (skipDebugInstructionsForward(MBB2->begin(), MBB2->end(), false) == I2) I2 = MBB2->begin(); bool FullBlockTail1 = I1 == MBB1->begin(); @@ -1217,7 +1217,7 @@ bool BranchFolder::OptimizeBranches(MachineFunction &MF) { // Blocks should be considered empty if they contain only debug info; // else the debug info would affect codegen. static bool IsEmptyBlock(MachineBasicBlock *MBB) { - return MBB->getFirstNonDebugInstr() == MBB->end(); + return MBB->getFirstNonDebugInstr(true) == MBB->end(); } // Blocks with only debug info and branches should be considered the same @@ -1919,8 +1919,8 @@ bool BranchFolder::HoistCommonCodeInSuccs(MachineBasicBlock *MBB) { MachineBasicBlock::iterator FIE = FBB->end(); while (TIB != TIE && FIB != FIE) { // Skip dbg_value instructions. These do not count. - TIB = skipDebugInstructionsForward(TIB, TIE); - FIB = skipDebugInstructionsForward(FIB, FIE); + TIB = skipDebugInstructionsForward(TIB, TIE, false); + FIB = skipDebugInstructionsForward(FIB, FIE, false); if (TIB == TIE || FIB == FIE) break; |