[GHC] #16333: Implement Loop-invariant code motion / Hoisting for Cmm

GHC ghc-devs at haskell.org
Sun Feb 17 10:02:28 UTC 2019


#16333: Implement Loop-invariant code motion / Hoisting for Cmm
-------------------------------------+-------------------------------------
           Reporter:  AndreasK       |             Owner:  (none)
               Type:  task           |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.6.3
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:  #12808
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 Currently we don't but we should.

 An example from nofib:

 This is the innermost loop of fannkuch-redux.

 {{{
 #!C
        ca12:
            _s9D0::I64 = %MO_UU_Conv_W8_W64(I8[_s9zN::I64]);
            if (_s9D0::I64 != 0) goto ca1f; else goto ca1i;
        ca1f:
            I64[Sp - 16] = ca1d;
            R3 = _s9zN::I64 + _s9D0::I64;
            R2 = _s9zN::I64;
            I64[Sp - 8] = _s9CV::I64;
            I64[Sp] = _s9Cd::I64;
            I64[Sp + 40] = _s9Cc::I64;
            I64[Sp + 48] = _s9Cb::I64;
            I64[Sp + 56] = _s9zN::I64;
            Sp = Sp - 16;
            call $wflopp_r9x0_info(R3,
                                   R2) returns to ca1d, args: 8, res: 8,
 upd: 8;
        ca1d:
            Sp = Sp + 16;
            _s9CV::I64 = I64[Sp - 8] + 1;
            _s9Cd::I64 = I64[Sp + 0]; 16
            _s9z5::I64 = I64[Sp + 8]; //24
            _s9zv::I64 = I64[Sp + 16]; 32
            _s9zx::I64 = I64[Sp + 24]; 40
            _s9zz::I64 = I64[Sp + 32]; 48
            _s9Cc::I64 = I64[Sp + 40]; 56
            _s9Cb::I64 = I64[Sp + 48]; 64
            _s9zN::I64 = I64[Sp + 56]; 72

            goto ca12;
 }}}

 We should try to move the loads NOT used in the loop out of the loop at
 least.

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


More information about the ghc-tickets mailing list