diff options
| author | Markus Lavin <markus.lavin@ericsson.com> | 2022-06-21 08:08:06 +0200 |
|---|---|---|
| committer | Markus Lavin <markus.lavin@ericsson.com> | 2022-06-21 08:13:09 +0200 |
| commit | 3815ae29b5cb43333adde04df9d9a7a644b77d68 (patch) | |
| tree | b9a242f1baa8900ef91793365d73dfb2ba636e78 /llvm/lib/CodeGen/MachineBasicBlock.cpp | |
| parent | ca4af13e480e856f8f889c1e145308fc4eb69816 (diff) | |
[machinesink] fix debug invariance issue
Do not include debug instructions when comparing block sizes with
thresholds.
Differential Revision: https://reviews.llvm.org/D127208
Diffstat (limited to 'llvm/lib/CodeGen/MachineBasicBlock.cpp')
| -rw-r--r-- | llvm/lib/CodeGen/MachineBasicBlock.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/MachineBasicBlock.cpp b/llvm/lib/CodeGen/MachineBasicBlock.cpp index 9f6be9aba632..26e84101dbd1 100644 --- a/llvm/lib/CodeGen/MachineBasicBlock.cpp +++ b/llvm/lib/CodeGen/MachineBasicBlock.cpp @@ -1617,6 +1617,16 @@ MachineBasicBlock::liveout_iterator MachineBasicBlock::liveout_begin() const { return liveout_iterator(*this, ExceptionPointer, ExceptionSelector, false); } +bool MachineBasicBlock::sizeWithoutDebugLargerThan(unsigned Limit) const { + unsigned Cntr = 0; + auto R = instructionsWithoutDebug(begin(), end()); + for (auto I = R.begin(), E = R.end(); I != E; ++I) { + if (++Cntr > Limit) + return true; + } + return false; +} + const MBBSectionID MBBSectionID::ColdSectionID(MBBSectionID::SectionType::Cold); const MBBSectionID MBBSectionID::ExceptionSectionID(MBBSectionID::SectionType::Exception); |
