Skip to content
  • Michal Terepeta's avatar
    cmm/CmmLayoutStack: avoid generating unnecessary reloads · 6a2264d2
    Michal Terepeta authored and Ben Gamari's avatar Ben Gamari committed
    
    
    This tries to be more precise when generating reloads of local
    registers in proc points. Previously we'd reload all local registers
    that were live. But we used liveness information that assumed local
    registers survive native calls. For the purpose of reloading registers
    this is an overapproximation and might lead to generating huge amounts
    of unnecessary reloads (in case there's another proc point before the
    register is used).
    
    This change takes the approach of moving the generation of reloads to
    a second pass over the Cmm, which allows to recompute the liveness and
    can use the knowledge that local registers do *not* survive calls.
    This leads to generating only useful reloads. For an extreme example
    where this helps a lot please see T3294. This should also fix #7198
    
    Finally, this re-introduces the code to do Cmm rewriting using in
    `Dataflow` module (with the difference that we know operate on a whole
    block at a time).
    
    Signed-off-by: default avatarMichal Terepeta <michal.terepeta@gmail.com>
    
    Reviewers: austin, bgamari, simonmar
    
    Reviewed By: simonmar
    
    Subscribers: kavon, rwbarton, thomie
    
    GHC Trac Issues: #7198
    
    Differential Revision: https://phabricator.haskell.org/D3586
    6a2264d2