diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2017-03-17 16:25:41 +0000 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2017-03-17 16:31:13 +0000 |
commit | a7dbafe9292212f3cbc21be42eb326ab0701db7e (patch) | |
tree | 491cefd34aa9c60948e161469eaa7fccd592d051 /testsuite/tests/simplCore | |
parent | 567bc6bd194836233ce1576acd7a62b1867f6607 (diff) | |
download | haskell-a7dbafe9292212f3cbc21be42eb326ab0701db7e.tar.gz |
No join-point from an INLINE function with wrong arity
The main payload of this patch is NOT to make a join-point
from a function with an INLINE pragma and the wrong arity;
see Note [Join points and INLINE pragmas] in CoreOpt.
This is what caused Trac #13413.
But we must do the exact same thing in simpleOptExpr,
which drove me to the following refactoring:
* Move simpleOptExpr and simpleOptPgm from CoreSubst to a new
module CoreOpt along with a few others (exprIsConApp_maybe,
pushCoArg, etc)
This eliminates a module loop altogether (delete
CoreArity.hs-boot), and stops CoreSubst getting too huge.
* Rename Simplify.matchOrConvertToJoinPoint
to joinPointBinding_maybe
Move it to the new CoreOpt
Use it in simpleOptExpr as well as in Simplify
* Define CoreArity.joinRhsArity and use it
Diffstat (limited to 'testsuite/tests/simplCore')
-rw-r--r-- | testsuite/tests/simplCore/should_compile/T13413.hs | 19 | ||||
-rw-r--r-- | testsuite/tests/simplCore/should_compile/all.T | 1 |
2 files changed, 20 insertions, 0 deletions
diff --git a/testsuite/tests/simplCore/should_compile/T13413.hs b/testsuite/tests/simplCore/should_compile/T13413.hs new file mode 100644 index 0000000000..63de8b3268 --- /dev/null +++ b/testsuite/tests/simplCore/should_compile/T13413.hs @@ -0,0 +1,19 @@ +{-# LANGUAGE MagicHash #-} +module T13413 where + +import GHC.Exts + +fillBlock2 :: (Int# -> Int# -> IO ()) + -> Int# -> Int# -> IO () + +fillBlock2 write x0 y0 + = fillBlock y0 x0 + where + {-# INLINE fillBlock #-} + fillBlock y ix + | 1# <- y >=# y0 + = return () + | otherwise + = do write ix x0 + fillBlock (y +# 1#) ix + diff --git a/testsuite/tests/simplCore/should_compile/all.T b/testsuite/tests/simplCore/should_compile/all.T index 5265569503..98d7d79835 100644 --- a/testsuite/tests/simplCore/should_compile/all.T +++ b/testsuite/tests/simplCore/should_compile/all.T @@ -251,3 +251,4 @@ test('T13340', normal, run_command, ['$MAKE -s --no-print-directory T13340']) test('T13338', only_ways(['optasm']), compile, ['-dcore-lint']) test('T13367', normal, run_command, ['$MAKE -s --no-print-directory T13367']) test('T13417', normal, compile, ['-O']) +test('T13413', normal, compile, ['']) |