Ticket #4463 (new bug)
CORE notes break optimisation
| Reported by: | rl | Owned by: | |
|---|---|---|---|
| Priority: | low | Milestone: | _|_ |
| Component: | Compiler | Version: | 7.1 |
| Keywords: | Cc: | choener@… | |
| Operating System: | Unknown/Multiple | Architecture: | Unknown/Multiple |
| Type of failure: | Runtime performance bug | Difficulty: | |
| Test Case: | Blocked By: | ||
| Blocking: | Related Tickets: |
Description
I think at some point we decided that Core notes shouldn't affect optimisation. Here is a case where they do:
module Foo where
foo :: Int -> Int
{-# INLINE [1] foo #-}
foo x = x+1
{-# RULES "foo/foo" forall x. foo (foo x) = x #-}
module Bar where
import Foo
bar :: Int -> Int -> Int
bar x y = foo ({-# CORE "note" #-} x `seq` foo y)
When compiled with -O2, the rule doesn't fire with the note but does fire without it. This is the Core with the note:
Bar.bar =
\ (x_aaw :: GHC.Types.Int) (y_aax :: GHC.Types.Int) ->
Foo.foo
(__core_note "note"
(case x_aaw of _ { GHC.Types.I# _ -> Foo.foo y_aax }))
For the rule to fire, GHC must move the seq to the outside but because of the note, it doesn't.
Change History
Note: See
TracTickets for help on using
tickets.
