[PATCH] D127208: MachineSink debug invariance

Markus Lavin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 9 02:43:40 PDT 2022


markus added inline comments.


================
Comment at: llvm/lib/CodeGen/MachineBasicBlock.cpp:1622
+  auto R = instructionsWithoutDebug(begin(), end());
+  return std::distance(R.begin(), R.end());
+}
----------------
jmorse wrote:
> fhahn wrote:
> > One issue with this helper is that it needs to iterate over all instructions in the block to count them and the limit is used to decide whether the block is too big to process.
> > 
> > Not sure there's a good alternative, but maybe have something like `sizeWIthoutDebugLargerThan(x)` so we can at least bail out once the limit is reached.
> IIUC, basic block size is ilist size, which is already linear time anyway, so this wouldn't be a regression. That being said, putting a bound on this would be a neat extension.
Agree that it would be better to limit the number of instructions scanned but I worry that introducing such a function in `MachineBasicBlock` would make it slightly unsymmetric wrt its IR equivalent. Maybe it is worth it though, I can't really tell.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D127208/new/

https://reviews.llvm.org/D127208



More information about the llvm-commits mailing list