[GHC] #7574: Register allocator chokes on certain branches with literals

GHC ghc-devs at haskell.org
Mon Sep 23 11:58:45 CEST 2013


#7574: Register allocator chokes on certain branches with literals
-------------------------------------+-------------------------------------
        Reporter:  thoughtpolice     |            Owner:  simonmar
            Type:  bug               |           Status:  new
        Priority:  highest           |        Milestone:  7.8.1
       Component:  Compiler (NCG)    |          Version:  7.7
      Resolution:                    |         Keywords:  ncg, codegen
Operating System:  Unknown/Multiple  |     Architecture:  Unknown/Multiple
 Type of failure:  Compile-time      |       Difficulty:  Unknown
  crash                              |       Blocked By:  7573
       Test Case:                    |  Related Tickets:  #7571,#7534,
  codeGen/should_compile/T7574       |  #7814
        Blocking:                    |
-------------------------------------+-------------------------------------

Comment (by Simon Marlow <marlowsd@…>):

 In [changeset:f5879acd018494b84233f26fba828ce376d0f81d/ghc]:
 {{{
 #!CommitTicketReference repository="ghc"
 revision="f5879acd018494b84233f26fba828ce376d0f81d"
 Discard unreachable code in the register allocator (#7574)

 The problem with unreachable code is that it might refer to undefined
 registers.  This happens accidentally: a block can be orphaned by an
 optimisation, for example when the result of a comparsion becomes
 known.

 The register allocator panics when it finds an undefined register,
 because they shouldn't occur in generated code.  So we need to also
 discard unreachable code to prevent this panic being triggered by
 optimisations.

 The register alloator already does a strongly-connected component
 analysis, so it ought to be easy to make it discard unreachable code
 as part of that traversal.  It turns out that we need a different
 variant of the scc algorithm to do that (see Digraph), however the new
 variant also generates slightly better code by putting the blocks
 within a loop in a better order for register allocation.
 }}}

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



More information about the ghc-tickets mailing list