[GHC] #5924: Bad Cmm generated for updating one element in Array# (was: Back Cmm generated for updating one element in Array#)

GHC cvs-ghc at haskell.org
Sat Mar 10 01:00:49 CET 2012


#5924: Bad Cmm generated for updating one element in Array#
------------------------------+---------------------------------------------
 Reporter:  tibbe             |          Owner:                  
     Type:  bug               |         Status:  new             
 Priority:  normal            |      Component:  Compiler        
  Version:  7.4.1             |       Keywords:                  
       Os:  Unknown/Multiple  |   Architecture:  Unknown/Multiple
  Failure:  None/Unknown      |       Testcase:                  
Blockedby:                    |       Blocking:                  
  Related:                    |  
------------------------------+---------------------------------------------
Description changed by tibbe:

Old description:

> I've attached a small standalone program that implements the following
> function:
>
> {{{
> -- | /O(n)/ Update the element at the given position in this array.
> update16 :: Array e -> Int -> e -> Array e
> }}}
>
> which update one element (by copying the whole array) of an array of size
> 16. The attachment includes the optimized Cmm for a call to this
> function, together with a bunch of comments (inline with the Cmm) by me,
> pointing out inefficiencies in the generated Cmm.
>
> My overall goal is to make this particular function fast. This might
> involve fixes to the code generator and/or adding primitives whether that
> makes sense. In any case this code might be a good source of ideas for
> improvements to the code generator.

New description:

 I've attached a small standalone program that implements the following
 function:

 {{{
 -- | /O(n)/ Update the element at the given position in this array.
 update16 :: Array e -> Int -> e -> Array e
 }}}

 which update one element (by copying the whole array) of an array of size
 16. The attachment includes the optimized Cmm for a call to this function,
 together with a bunch of comments (inline with the Cmm) by me, pointing
 out inefficiencies in the generated Cmm.

 My overall goal is to make this particular function fast. This might
 involve fixes to the code generator and/or adding primitives whether that
 makes sense. In any case this code might be a good source of ideas for
 improvements to the code generator.

 To follow my annotations, start at `Update.test_info` in `Update.cmm`.

--

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



More information about the Glasgow-haskell-bugs mailing list