[GHC] #12028: Large let bindings are 6x slower (since 6.12.x to 7.10.x)

GHC ghc-devs at haskell.org
Tue Jun 14 07:59:22 UTC 2016


#12028: Large let bindings are 6x slower (since 6.12.x to 7.10.x)
-------------------------------------+-------------------------------------
        Reporter:  tommd             |                Owner:
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  7.10.3
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Compile-time      |  Unknown/Multiple
  performance bug                    |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by bgamari):

 * cc: simonmar (added)


Comment:

 Cc'ing Simon Marlow, who is quite familiar with the sinking pass.

 Indeed this example produces an extremely large amount of code (around
 2700 lines of C--) in `applyMD5Rounds`. Indeed the sink pass does do a
 significantly amount of fiddling with this code. For instance, prior to
 sinking much of the code for this function is bit twiddling,
 {{{
       _cbnY::I64 = _s9Sn::I64 ^ 4294967295;
       _s9WQ::I64 = _cbnY::I64;
       _cbo1::I64 = _s9WQ::I64 & _s9Sp::I64;
       _s9WR::I64 = _cbo1::I64;
       _cbo4::I64 = _s9Sn::I64 & _s9So::I64;
       _s9WP::I64 = _cbo4::I64;
       _cbo7::I64 = _s9WP::I64 | _s9WR::I64;
       _s9WS::I64 = _cbo7::I64;
       _cboa::I64 = _s9WS::I64 + _s9SG::I64;
       _s9WT::I64 = _cboa::I64;
       _cbod::I64 = %MO_UU_Conv_W32_W64(%MO_UU_Conv_W64_W32(_s9WT::I64));
       _s9WU::I64 = _cbod::I64;
       _cbog::I64 = _s9WU::I64 + 3614090360;
       _s9WV::I64 = _cbog::I64;
       _cboj::I64 = %MO_UU_Conv_W32_W64(%MO_UU_Conv_W64_W32(_s9WV::I64));
       _s9WW::I64 = _cboj::I64;
       _cbom::I64 = _s9WW::I64 + _s9Sm::I64;
       _s9WX::I64 = _cbom::I64;
       _cbop::I64 = %MO_UU_Conv_W32_W64(%MO_UU_Conv_W64_W32(_s9WX::I64));
       _s9WO::I64 = _cbop::I64;
       _cbos::I64 = _s9WO::I64 >> 25;
       _s9X0::I64 = _cbos::I64;
       _cbov::I64 = _s9WO::I64 << 7;
       _s9WZ::I64 = _cbov::I64;
       _cboy::I64 = _s9WZ::I64 | _s9X0::I64;
       _s9X1::I64 = _cboy::I64;
       _cboB::I64 = %MO_UU_Conv_W32_W64(%MO_UU_Conv_W64_W32(_s9X1::I64));
       _s9X2::I64 = _cboB::I64;
       _cboE::I64 = _s9X2::I64 + _s9Sn::I64;
       _s9X3::I64 = _cboE::I64;
       _cboH::I64 = %MO_UU_Conv_W32_W64(%MO_UU_Conv_W64_W32(_s9X3::I64));
       _s9WY::I64 = _cboH::I64;
       _cboK::I64 = _s9WY::I64 ^ 4294967295;
 }}}

 Which sinking turns into,

 {{{
       _s9WO::I64 =
 %MO_UU_Conv_W32_W64(%MO_UU_Conv_W64_W32(%MO_UU_Conv_W32_W64(%MO_UU_Conv_W64_W32(%MO_UU_Conv_W32_W64(%MO_UU_Conv_W64_W32(_s9Sn::I64
 & _s9So::I64 | _s9Sn::I64 ^ 4294967295 & _s9Sp::I64 + _s9SG::I64)) +
 3614090360)) + I64[Sp + 152]));
       _s9WY::I64 =
 %MO_UU_Conv_W32_W64(%MO_UU_Conv_W64_W32(%MO_UU_Conv_W32_W64(%MO_UU_Conv_W64_W32((_s9WO::I64
 << 7) | (_s9WO::I64 >> 25))) + _s9Sn::I64));
       _s9X4::I64 =
 %MO_UU_Conv_W32_W64(%MO_UU_Conv_W64_W32(%MO_UU_Conv_W32_W64(%MO_UU_Conv_W64_W32(%MO_UU_Conv_W32_W64(%MO_UU_Conv_W64_W32(_s9WY::I64
 & _s9Sn::I64 | _s9WY::I64 ^ 4294967295 & _s9So::I64 + _s9SX::I64)) +
 3905402710)) + _s9Sp::I64));
 }}}

 It would be interesting to know how the code produced by 6.12 differs from
 that produced by newer compilers.

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


More information about the ghc-tickets mailing list