#5237: Inefficient code generated for x^2
--------------------------------------+-------------------------------------
  Reporter:  scpmw                    |          Owner:                
      Type:  bug                      |         Status:  new           
  Priority:  normal                   |      Milestone:  7.4.1         
 Component:  libraries/base           |        Version:  7.0.3         
Resolution:                           |       Keywords:                
  Testcase:                           |      Blockedby:                
Difficulty:                           |             Os:  Linux         
  Blocking:                           |   Architecture:  x86_64 (amd64)
   Failure:  Runtime performance bug  |  
--------------------------------------+-------------------------------------

Comment(by daniel.is.fischer):

 I'm afraid no. Take Ian's programme from above, we have a `{-# RULES #-}`,
 `{-# SPECIALISE #-}` and `{-# NOINLINE #-}` pragma. Both, rule and
 specialisation, match. We want the rule to fire, but it's always `SPEC`
 that fires. If adding phase control to specialise pragmas works without
 making it `{-# SPECIALISE [NO]INLINE [k] #-}`, I haven't found out how.
 Every variation of that I tried, together with `{-# NOINLINE [k] #-}` or
 without, still had the specialisation firing.

 The only way to get the rule to fire was to remove the `SPECIALISE`
 pragma. But if we remove that from `GHC.Real`, we get code bloat because a
 specialisation will be generated in every module using `(^)`.

 Interestingly, adding a phase to the `RULES` pragma prevented that from
 firing even without the `SPECIALISE`.

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

_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to