This is an alternative to D120330, which disables MachineSink for functions with irreducible cycles entirely. This avoids both the correctness problem, and ensures we don't perform non-profitable sinks into cycles. At the same time, it may also disable profitable sinks in the same function.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
LGTM. Thanks for fixing this. I will check MachineCycleInfo for the main branch if you don't plan to do so.
Hello. This seems to be increasing codesize by quite a large amount in places at -Oz. Up to 9% in one case! (They tend to be machine-outliner related when they get that large). It seems to be increasing codesize in general, I would guess because having irreducible loops somewhere throughout a large function can be quite common.
My initial thought is to bail out only if the loop containing MBB or SuccToSinkTo in isProfitableToSinkTo contains irreducible cfg or not. I guess we checked the whole function instead of the single loop because LoopBlocksRPO(which is suitable to check a single loop) does not have a MachineLoop version?
I plan to do this based on MachineCycleInfo for the main branch, But I need more time. If this code size issue caused by this approach is some kind of seriousness and urgent, yes, I am also OK to use the alternatives, D120330, or revert D86864.