[commit: ghc] master: Discard unreachable code in the register allocator (#7574) (f5879ac)

git at git.haskell.org git at git.haskell.org
Mon Sep 23 11:58:50 CEST 2013


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/f5879acd018494b84233f26fba828ce376d0f81d/ghc

>---------------------------------------------------------------

commit f5879acd018494b84233f26fba828ce376d0f81d
Author: Simon Marlow <marlowsd at gmail.com>
Date:   Sat Sep 21 18:32:33 2013 +0100

    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.


>---------------------------------------------------------------

f5879acd018494b84233f26fba828ce376d0f81d
 compiler/nativeGen/Instruction.hs       |   13 ++++++++++
 compiler/nativeGen/RegAlloc/Liveness.hs |   40 +++++++++++++++++++++++++------
 compiler/nativeGen/X86/Instr.hs         |   10 ++------
 compiler/utils/Digraph.lhs              |   30 +++++++++++++++++++----
 4 files changed, 73 insertions(+), 20 deletions(-)

Diff suppressed because of size. To see it, use:

    git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc f5879acd018494b84233f26fba828ce376d0f81d



More information about the ghc-commits mailing list