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

GHC ghc-devs at haskell.org
Sat Oct 21 10:21:14 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):

 `-fcmm-elim-common-blocks` helps a bit, but many equal ones are not
 caught:

 These hash the same
 {{{
 hash_block
   c3dj
   170
 hash_block
   c3dp
   170
 hash_block
   c3dv
   170
 hash_block
   c3dB
   170
 }}}

 but are not commoned:
 {{{
 ==================== Post switch plan ====================
 {offset
   c3dj: // global
       R1 = R1 + 7;
       call (P64[(old + 8)])(R1) args: 8, res: 0, upd: 8;
 }



 ==================== Post switch plan ====================
 {offset
   c3dp: // global
       R1 = R1 + 7;
       call (P64[(old + 8)])(R1) args: 8, res: 0, upd: 8;
 }



 ==================== Post switch plan ====================
 {offset
   c3dv: // global
       R1 = R1 + 7;
       call (P64[(old + 8)])(R1) args: 8, res: 0, upd: 8;
 }



 ==================== Post switch plan ====================
 {offset
   c3dB: // global
       R1 = R1 + 7;
       call (P64[(old + 8)])(R1) args: 8, res: 0, upd: 8;
 }
 }}}


 Maybe the reason is the "result register" updates are not considered in
 `CmmCommonBlockElim.hs`.

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


More information about the ghc-tickets mailing list