I think the inliner assumes temporaries are single-assignment. Could that be the problem?

Cheers,
        Simon

On 30/03/11 18:25, Edward Z. Yang wrote:
I believe I've run into an inliner bug.  (This is the "new codegen
starts segfaulting stage2 GHC after I started inlining across comments").
The following code:

          // outOfLine should follow:
          _c21P::I32 = _s1uR::I32 == _s1uS::I32;
          // emitReturn: Sequel: Assign
          _s20i::I32 = I32[GHC.Types.Bool_closure_tbl + (_c21P::I32<<  2)];
          _c21Q::I32 = _s20i::I32&  3;
          if (_c21Q::I32>= 2) goto c21k;
          // outOfLine should follow:
          _c21u::I32 = _s1uR::I32 + 1;
          // emitReturn: Sequel: Assign
          _s20j::I32 = _c21u::I32;
          _c21y::I32 = _s1uX::I32 * 128;
          // emitReturn: Sequel: Assign
          _s20k::I32 = _c21y::I32;
          _c21C::I32 = %MO_UU_Conv_W8_W32(I8[_s1uU::I32 + (_s1uR::I32<<  0)]);
          // emitReturn: Sequel: Assign
          _s20l::I32 = _c21C::I32;
          _c21G::I32 = _s20l::I32;
          // emitReturn: Sequel: Assign
          _s20m::I32 = _c21G::I32;
          _c21K::I32 = _s20m::I32 + _s20k::I32;
          // emitReturn: Sequel: Assign
          _s20n::I32 = _c21K::I32;
          _c21O::I32 = %MO_S_Rem_W32(_s20n::I32, 4091);
          // emitReturn: Sequel: Assign
          _s20o::I32 = _c21O::I32;
          _s1uR::I32 = _s20j::I32;
          _s1uX::I32 = _s20o::I32;
          goto c21a;

Gets optimized into:

         // outOfLine should follow:
         // emitReturn: Sequel: Assign
         if (I32[((_s1uR::I32 == _s1uS::I32)<<  2) + GHC.Types.Bool_closure_tbl]&  
3>= 2) goto c21k;
         // outOfLine should follow:
         // emitReturn: Sequel: Assign
         // emitReturn: Sequel: Assign
         // emitReturn: Sequel: Assign
         // emitReturn: Sequel: Assign
         // emitReturn: Sequel: Assign
         // emitReturn: Sequel: Assign
         _s1uR::I32 = _s1uR::I32 + 1;
         _s1uX::I32 = %MO_S_Rem_W32(%MO_UU_Conv_W8_W32(I8[_s1uU::I32 + _s1uR::I32]) + 
(_s1uX::I32<<  7),
                                    4091);

For whatever reason, _s1uR has been inlined into an immediate increment, which 
is definitely
incorrect since the dereference at _c21C is still working off the old version.

I'll look more closely at the inliner tomorrow and see if I can figure out 
where the bug is.

Edward

_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc


_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to