diff options
Diffstat (limited to 'testsuite/tests/eyeball/inline2.hs')
-rw-r--r-- | testsuite/tests/eyeball/inline2.hs | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/testsuite/tests/eyeball/inline2.hs b/testsuite/tests/eyeball/inline2.hs new file mode 100644 index 0000000000..45bb04bf8b --- /dev/null +++ b/testsuite/tests/eyeball/inline2.hs @@ -0,0 +1,40 @@ +{-# OPTIONS -fglasgow-exts -O -dshow-passes #-} + +module Foo where +import GHC.Base + +foo :: Int -> Int +foo (I# n#) = bar i i + where i# = n# +# 1# + i = I# i# + +bar :: Int -> Int -> Int +{-# INLINE [0] bar #-} +bar _ n = n + +{- The trouble here was + + *** Simplify: + Result size = 25 + Result size = 25 + Result size = 25 + Result size = 25 + Result size = 25 + *** Simplify: + Result size = 25 + Result size = 25 + Result size = 25 + Result size = 25 + Result size = 25 + + + etc. + +The reason was this: + x = n# +# 1# + i = I# x + +Being an unboxed value, we were treating the argument context of x +as intersting, and hence inlining x in the arg of I#. But then we just +float it out again, giving an infinite loop. +-} |