[GHC] #9157: cmm common block not eliminated

GHC ghc-devs at haskell.org
Mon Jun 2 07:17:32 UTC 2014


#9157: cmm common block not eliminated
-------------------------------------+------------------------------------
        Reporter:  wojteknar         |            Owner:  jstolarek
            Type:  bug               |           Status:  new
        Priority:  normal            |        Milestone:
       Component:  Compiler          |          Version:  7.8.2
      Resolution:                    |         Keywords:
Operating System:  Unknown/Multiple  |     Architecture:  Unknown/Multiple
 Type of failure:  Other             |       Difficulty:  Unknown
       Test Case:                    |       Blocked By:
        Blocking:                    |  Related Tickets:
-------------------------------------+------------------------------------

Comment (by simonpj):

 I suspect that we ignore the labels the first time so that this works:
 {{{
 L1: x = x+1; goto L2
 L2: y = y+1; goto Lend

 L3: x = x+1; goto L3
 L4: y = y+1; goto Lend
 }}}
 Now L1 and L3 would be different if we took account of labels, but once L2
 and L4 are commoned up, L1 and L3 can be as well.

 Waiting for the sinking pass may well help, and I don't know why we don't
 do CBE at the end.  But it isn't enough in general.  Consider
 {{{
 L1: x = r+1; Sp[4] = x; Sp[8] = x*2; goto Lend
 L2: y = r+1; Sp[4] = y; Sp[8] = y*2; goto Lend
 }}}
 Here x and y look different but they are simply local temporaries.

 If we did a liveness analysis, the equality-comparing function could make-
 equivalent assignments to dead variables.  So when comparing L1 and L2,
 since x and y are dead, the first statements will compare ''equal'', and
 make x and y equivalent; hence the second statements will compare equal
 too.

 Anyway, I'm no expert here; I have not looked at the code.

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


More information about the ghc-tickets mailing list