Richards optCoercion improvement made test cases fail the nice way
[ghc.git] / testsuite / tests / eyeball / inline2.hs
1 {-# OPTIONS -fglasgow-exts -O -dshow-passes #-}
2
3 module Foo where
4 import GHC.Base
5
6 foo :: Int -> Int
7 foo (I# n#) = bar i i
8 where i# = n# +# 1#
9 i = I# i#
10
11 bar :: Int -> Int -> Int
12 {-# INLINE [0] bar #-}
13 bar _ n = n
14
15 {- The trouble here was
16
17 *** Simplify:
18 Result size = 25
19 Result size = 25
20 Result size = 25
21 Result size = 25
22 Result size = 25
23 *** Simplify:
24 Result size = 25
25 Result size = 25
26 Result size = 25
27 Result size = 25
28 Result size = 25
29
30
31 etc.
32
33 The reason was this:
34 x = n# +# 1#
35 i = I# x
36
37 Being an unboxed value, we were treating the argument context of x
38 as intersting, and hence inlining x in the arg of I#. But then we just
39 float it out again, giving an infinite loop.
40 -}