[GHC] #14372: CMM contains a bunch of tail-merging opportunities

GHC ghc-devs at haskell.org
Tue Oct 24 09:09:26 UTC 2017


#14372: CMM contains a bunch of tail-merging opportunities
-------------------------------------+-------------------------------------
        Reporter:  heisenbug         |                Owner:  (none)
            Type:  feature request   |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.2.1
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by heisenbug):

 Replying to [comment:10 simonpj]:
 > It's hard to review code without a spec, or even some input/output
 examples.
 >
 > And an overview Note to explain the goal and how the impl works would be
 useful.

 Will do. I am in a very early stage :-)

 >
 > Based on a very quick look, it seems that you hope to branch from one
 `CmmProc` to a label in another.  That's a huge thing to do, because it
 messes up all dataflow analyses, which expect to be able to see all the
 places that jump to a block (e.g. constant propagation).  I'm 99% sure
 that you can't translate it into LLVM.

 You are correct. We can only branch to labels that we emit. So this
 probably will be a NCG-only thing (C-backend is off-limits too), unless we
 find a way to invoke the "outliner" in LLVM specifically.

 What I have observed that sometimes previously noted labels disappear due
 to optimisation. So I'll have to move the commoning to the end of the Cmm
 pipeline.

 >
 > Before you invest a lot more effort, can we debate the goal?  There are
 others on ghc-devs who know about this back-end stuff.

 Sure. First and above all I am trying to learn and understand the inner
 workings of Cmm. Let me just get this working with bootstrap and we can
 discuss. I'll also need to gather some statistics.

 Thanks for the review, Simon!

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14372#comment:11>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list