[PATCH] D120330: [MachineSink] Fix CFG walk in clobber check (PR53990)

ChenZheng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 24 00:56:08 PST 2022


shchenz added a comment.

> It should be possible to do this by switching MachineSink from using MachineLoopInfo to MachineCycleInfo, which supports irreducible cycles. I think this allows a better profitability decision, but I'm not entirely sure that it would be a sufficient correctness condition, as irreducible cycles are DFS-order dependent. In any case, MachineCycleInfo is a new addition that is not actually used anywhere yet, so I don't think this would be appropriate for an LLVM 14 backport.

Yes, I agree changing MachineLoopInfo to MachineCycleInfo would be a little risky for backport. Could we just simply mark it as not profitable in `isProfitableToSinkTo` if `MBB` or `SuccToSinkTo` is in a loop that contains IrreducibleCFG.

For this case, IMO, not allowing the sink should be the right choice as block To is in a deeper loop? Apart from the load/store sink, we may sink some other instructions to a hot loop. And not sure other queries from MachineLoopInfo in this pass have the right behavior for an irreducible loop.


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

https://reviews.llvm.org/D120330



More information about the llvm-commits mailing list