Some more questions about Cmm pipeline

Jan Stolarek jan.stolarek at
Fri Jul 12 10:20:10 CEST 2013

I have two more questions:

3. I will be doing copy propagation within a procedure graph, after which I will need to run dead code elimination. My understanding of CmmLive is that it computes liveness analysis at the entry to each basic block, which implies I will not be able to use information generated by CmmLive for dead code elimination within a block. Is that correct?

4. Speaking of unused code, there is a disabled CmmSink pass just before stack layout is done. Can I remove that commented fragment or are there plans to re-enable this pass at some point in the future?


----- Oryginalna wiadomość -----
Od: "Simon Marlow" <marlowsd at>
Do: "Jan Stolarek" <jan.stolarek at>
DW: ghc-devs at
Wysłane: czwartek, 11 lipiec 2013 17:52:49
Temat: Re: Some more questions about Cmm pipeline

1. Was a quick hack that I did sometime in the past, it probably didn't work fully. Nowadays LLVM does loopification, so its not clear whether there's any benefit to doing it in cmm (but maybe there's some other payoff that we can get by doing it earlier). 

2. Is Edward Yang's optimisation pass. Disabled because it is crazy expensive; I wrote CmmSink instead which does most of the same things and a few more. We should remove the code now that we're not going to use it. 
On 11 Jul 2013 11:37, "Jan Stolarek" < jan.stolarek at > wrote: 

Hi Simon, 

I have two questions about the Cmm pipeline: 

1. I implemented a pass that replaces tail calls with a copy of the entry block we're calling to. This is slightly extended version of loopification which will hopefully enable further optimisations. Then I noticed that loopification pass used to be implemented (cmm/CmmOpt.hs, line 418) but was commented out (d92bd17ffd8715f77fd49de0fed6e39c8d0ec28b). There's also a comment: "XXX: revisit if we actually want to do this". What was the motivation for removing loopification? Is there a reason why we might not want to do it? 

2. There is a module cmm/CmmRewriteAssignments.hs, which is not used at the moment. What was the motivation for disabling that pass? 


More information about the ghc-devs mailing list