diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2021-07-29 20:15:26 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2021-07-29 20:15:26 +0000 |
| commit | 344a3780b2e33f6ca763666c380202b18aab72a3 (patch) | |
| tree | f0b203ee6eb71d7fdd792373e3c81eb18d6934dd /llvm/lib/CodeGen/BranchFolding.cpp | |
| parent | b60736ec1405bb0a8dd40989f67ef4c93da068ab (diff) | |
vendor/llvm-project/llvmorg-13-init-16847-g88e66fa60ae5vendor/llvm-project/llvmorg-12.0.1-rc2-0-ge7dac564cd0evendor/llvm-project/llvmorg-12.0.1-0-gfed41342a82f
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; |
