#5237: Inefficient code generated for x^2
-------------------------------+--------------------------------------------
Reporter: scpmw | Owner:
Type: bug | Status: patch
Priority: normal | Milestone: 7.4.1
Component: libraries/base | Version: 7.0.3
Keywords: | Testcase:
Blockedby: | Difficulty:
Os: Linux | Blocking:
Architecture: x86_64 (amd64) | Failure: Runtime performance bug
-------------------------------+--------------------------------------------
Comment(by daniel.is.fischer):
I've tested the rules in the last days, with mixed success. For Int and
Integer, where the rules are in the same place as `(^)`, they fire okay,
unless specialisation gets in the way (so far, that affects `Integer ->
Integer -> Integer`, `Integer -> Int -> Integer` and `Int -> Int -> Int`).
To get the rules for `Word` exponents to fire, I had to specify the
exponent as `W# n##`, so those rules seem pretty useless.
For the types we have specialisations for, specialising is done before
rule-rewriting, apparently. I think it might be good to have a rule-
rewriting pass before any other optimisations are tried, based on the
assumption that rules generally are written to give large benefits, while
general optimisations often give only a small benefit. If it's easy enough
to add a rule-scanning pass before other simplifications, it's worth
thinking about it.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5237#comment:4>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs