[PATCH] D127208: MachineSink debug invariance
Markus Lavin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 7 06:59:55 PDT 2022
markus updated this revision to Diff 434806.
markus added a reviewer: Orlando.
markus added a comment.
Add `MachineBasicBlock::sizeWithoutDebug()` to make more similar to IR.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D127208/new/
https://reviews.llvm.org/D127208
Files:
llvm/include/llvm/CodeGen/MachineBasicBlock.h
llvm/lib/CodeGen/MachineBasicBlock.cpp
llvm/lib/CodeGen/MachineSink.cpp
Index: llvm/lib/CodeGen/MachineSink.cpp
===================================================================
--- llvm/lib/CodeGen/MachineSink.cpp
+++ llvm/lib/CodeGen/MachineSink.cpp
@@ -1175,7 +1175,7 @@
// If this BB is too big or the block number in straight line between From
// and To is too big, stop searching to save compiling time.
- if (BB->size() > SinkLoadInstsPerBlockThreshold ||
+ if (BB->sizeWithoutDebug() > SinkLoadInstsPerBlockThreshold ||
HandledDomBlocks.size() > SinkLoadBlocksThreshold) {
for (auto *DomBB : HandledDomBlocks) {
if (DomBB != BB && DT->dominates(DomBB, BB))
@@ -1277,7 +1277,7 @@
dbgs() << "CycleSink: Not sinking, sink block is the preheader\n");
return false;
}
- if (SinkBlock->size() > SinkLoadInstsPerBlockThreshold) {
+ if (SinkBlock->sizeWithoutDebug() > SinkLoadInstsPerBlockThreshold) {
LLVM_DEBUG(
dbgs() << "CycleSink: Not Sinking, block too large to analyse.\n");
return false;
Index: llvm/lib/CodeGen/MachineBasicBlock.cpp
===================================================================
--- llvm/lib/CodeGen/MachineBasicBlock.cpp
+++ llvm/lib/CodeGen/MachineBasicBlock.cpp
@@ -1617,6 +1617,11 @@
return liveout_iterator(*this, ExceptionPointer, ExceptionSelector, false);
}
+unsigned MachineBasicBlock::sizeWithoutDebug() const {
+ auto R = instructionsWithoutDebug(begin(), end());
+ return std::distance(R.begin(), R.end());
+}
+
const MBBSectionID MBBSectionID::ColdSectionID(MBBSectionID::SectionType::Cold);
const MBBSectionID
MBBSectionID::ExceptionSectionID(MBBSectionID::SectionType::Exception);
Index: llvm/include/llvm/CodeGen/MachineBasicBlock.h
===================================================================
--- llvm/include/llvm/CodeGen/MachineBasicBlock.h
+++ llvm/include/llvm/CodeGen/MachineBasicBlock.h
@@ -246,6 +246,7 @@
MachineInstrBundleIterator<const MachineInstr, true>;
unsigned size() const { return (unsigned)Insts.size(); }
+ unsigned sizeWithoutDebug() const;
bool empty() const { return Insts.empty(); }
MachineInstr &instr_front() { return Insts.front(); }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D127208.434806.patch
Type: text/x-patch
Size: 2189 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220607/28265e90/attachment.bin>
More information about the llvm-commits
mailing list