summaryrefslogtreecommitdiff
path: root/testsuite/tests/eyeball/inline2.hs
diff options
context:
space:
mode:
authorDavid Terei <davidterei@gmail.com>2011-07-20 11:09:03 -0700
committerDavid Terei <davidterei@gmail.com>2011-07-20 11:26:35 -0700
commit16514f272fb42af6e9c7674a9bd6c9dce369231f (patch)
treee4f332b45fe65e2a7a2451be5674f887b42bf199 /testsuite/tests/eyeball/inline2.hs
parentebd422aed41048476aa61dd4c520d43becd78682 (diff)
downloadhaskell-16514f272fb42af6e9c7674a9bd6c9dce369231f.tar.gz
Move tests from tests/ghc-regress/* to just tests/*
Diffstat (limited to 'testsuite/tests/eyeball/inline2.hs')
-rw-r--r--testsuite/tests/eyeball/inline2.hs40
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.
+-}