[GHC] #11158: Combine exprIsTrivial and cpe_ExprIsTrivial

GHC ghc-devs at haskell.org
Thu Oct 13 13:08:16 UTC 2016


#11158: Combine exprIsTrivial and cpe_ExprIsTrivial
-------------------------------------+-------------------------------------
        Reporter:  simonpj           |                Owner:
            Type:  task              |               Status:  infoneeded
        Priority:  highest           |            Milestone:  8.2.1
       Component:  Compiler          |              Version:  7.10.2
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):  Phab:D1656
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by nomeata):

 I get
 {{{
 T11158.f
   :: forall a1_aDG a2_aDF t_aDp.
      t_aDp -> (GHC.Base.Maybe a2_aDF, GHC.Base.Maybe a1_aDG)
 [GblId, Arity=1, Caf=NoCafRefs, Unf=OtherCon []] =
     \r [x_sNH]
         let {
           sat_sNJ [Occ=Once] :: GHC.Base.Maybe a_aDG
           [LclId] =
               NO_CCS GHC.Base.Nothing! []; } in
         let {
           sat_sNI [Occ=Once] :: GHC.Base.Maybe a1_aDF
           [LclId] =
               NO_CCS GHC.Base.Nothing! [];
         } in  (,) [sat_sNI sat_sNJ];
 }}}
 and
 {{{
 ==================== Output Cmm ====================
 [section ""data" . T11158.f_closure" {
      T11158.f_closure:
          const T11158.f_info;
  },
  T11158.f_entry() //  [R2]
          { info_tbl: [(cNQ,
                        label: T11158.f_info
                        rep:HeapRep static { Fun {arity: 1 fun_type:
 ArgSpec 5} })]
            stack_info: arg_space: 8 updfr_space: Just 8
          }
      {offset
        cNQ:
            _sNG::P64 = R2;
            goto cNS;
        cNS:
            Hp = Hp + 24;
            if (Hp > HpLim) goto cNU; else goto cNT;
        cNU:
            HpAlloc = 24;
            goto cNR;
        cNR:
            R2 = _sNG::P64;
            R1 = T11158.f_closure;
            call (stg_gc_fun)(R2, R1) args: 8, res: 0, upd: 8;
        cNT:
            I64[Hp - 16] = (,)_con_info;
            P64[Hp - 8] = GHC.Base.Nothing_closure+1;
            P64[Hp] = GHC.Base.Nothing_closure+1;
            _cNP::P64 = Hp - 15;
            R1 = _cNP::P64;
            call (P64[Sp])(R1) args: 8, res: 0, upd: 8;
      }
  }]
 }}}
 which looks reasonable, doesn’t it?

 But here is an interesting difference, which might be a clue. Before my
 patch:
 {{{
 ==================== Output Cmm ====================
 [section ""relreadonly" . SOb_srt" {
      SOb_srt:
          const GHC.Base.$fMonadIO_closure;
  }]
 }}}
 After my patch:
 {{{
 ==================== Output Cmm ====================
 [section ""relreadonly" . SNV_srt" {
      SNV_srt:
          const GHC.Base.Nothing_closure;
          const GHC.Base.$fMonadIO_closure;
          const sat_sNJ_closure;
  }]
 }}}
 Is it kosher to add a static constructor closure to the `srt` table?

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


More information about the ghc-tickets mailing list