HORIZON HASKELLDocslts/ghc-9.14.xb2f3bfd2026-10-11Search names, modules, packages, or :: a typeCtrl K

GHC 9.14.1 · lts/ghc-9.14.x · b2f3bfd · 2026-10-11

Moduleghc-9.14.1GHC2021

GHC.CmmToAsm.Reg.Graph.SpillClean

Clean out unneeded spill/reload instructions.

Handling of join points ~~~~~~~~~~~~~~~~~~~~~~~

  B1:                          B2:
   ...                          ...
      RELOAD SLOT(0), %r1          RELOAD SLOT(0), %r1
      ... A ...                    ... B ...
      jump B3                      jump B3

               B3: ... C ...
                   RELOAD SLOT(0), %r1
                   ...
  

The Plan ~~~~~~~~

As long as %r1 hasn't been written to in A, B or C then we don't need the reload in B3.

What we really care about here is that on the entry to B3, %r1 will always have the same value that is in SLOT(0) (ie, %r1 is _valid_)

This also works if the reloads in B1/B2 were spills instead, because spilling %r1 to a slot makes that slot have the same value as %r1.

  • 1 value
  • Packageghc-9.14.1
  • Exports1
  • LanguageGHC2021
  • LicenceBSD-3-Clause
  • SourceSpillClean.hs