diff options
-rw-r--r-- | compiler/GHC/Core/Opt/Simplify.hs | 3 | ||||
-rw-r--r-- | testsuite/tests/simplCore/should_compile/T18668.hs | 11 | ||||
-rw-r--r-- | testsuite/tests/simplCore/should_compile/T18668.stderr | 24 | ||||
-rw-r--r-- | testsuite/tests/simplCore/should_compile/all.T | 1 |
4 files changed, 38 insertions, 1 deletions
diff --git a/compiler/GHC/Core/Opt/Simplify.hs b/compiler/GHC/Core/Opt/Simplify.hs index 22d0bb47c0..fc3373419e 100644 --- a/compiler/GHC/Core/Opt/Simplify.hs +++ b/compiler/GHC/Core/Opt/Simplify.hs @@ -2182,7 +2182,8 @@ tryRules env rules fn args call_cont [ text "Rule:" <+> ftext (ruleName rule) , text "Module:" <+> printRuleModule rule , text "Before:" <+> hang (ppr fn) 2 (sep (map ppr args)) - , text "After: " <+> pprCoreExpr rule_rhs + , text "After: " <+> hang (pprCoreExpr rule_rhs) 2 + (sep $ map ppr $ drop (ruleArity rule) args) , text "Cont: " <+> ppr call_cont ] | dopt Opt_D_dump_rule_firings dflags diff --git a/testsuite/tests/simplCore/should_compile/T18668.hs b/testsuite/tests/simplCore/should_compile/T18668.hs new file mode 100644 index 0000000000..5e5ddb44df --- /dev/null +++ b/testsuite/tests/simplCore/should_compile/T18668.hs @@ -0,0 +1,11 @@ +{-# OPTIONS_GHC -O -ddump-rule-rewrites #-} +{-# LANGUAGE MagicHash #-} + +module T18668 where + +import GHC.Exts + +{-# RULES "funky" (+#) = (*#) #-} +{-# RULES "flip" forall x. (>#) x = (<#) x #-} + +x = (I# (2# +# 3#), I# (1# ># 0#)) diff --git a/testsuite/tests/simplCore/should_compile/T18668.stderr b/testsuite/tests/simplCore/should_compile/T18668.stderr new file mode 100644 index 0000000000..d2f1693004 --- /dev/null +++ b/testsuite/tests/simplCore/should_compile/T18668.stderr @@ -0,0 +1,24 @@ +Rule fired + Rule: funky + Module: (T18668) + Before: GHC.Prim.+# ValArg 2# ValArg 3# + After: GHC.Prim.*# ValArg 2# ValArg 3# + Cont: Stop[BoringCtxt] GHC.Prim.Int# +Rule fired + Rule: *# + Module: (BUILTIN) + Before: GHC.Prim.*# ValArg 2# ValArg 3# + After: 6# + Cont: Stop[BoringCtxt] GHC.Prim.Int# +Rule fired + Rule: flip + Module: (T18668) + Before: GHC.Prim.># ValArg 1# ValArg 0# + After: (\ (x :: GHC.Prim.Int#) -> GHC.Prim.<# x) 1# ValArg 0# + Cont: Stop[BoringCtxt] GHC.Prim.Int# +Rule fired + Rule: <# + Module: (BUILTIN) + Before: GHC.Prim.<# ValArg 1# ValArg 0# + After: 0# + Cont: Stop[BoringCtxt] GHC.Prim.Int# diff --git a/testsuite/tests/simplCore/should_compile/all.T b/testsuite/tests/simplCore/should_compile/all.T index 3bfc8c5c09..51d35322d1 100644 --- a/testsuite/tests/simplCore/should_compile/all.T +++ b/testsuite/tests/simplCore/should_compile/all.T @@ -341,4 +341,5 @@ test('T18649', normal, compile, ['-O -ddump-rules -Wno-simplifiable-class-constr test('T18747A', normal, compile, ['']) test('T18747B', normal, compile, ['']) test('T18815', only_ways(['optasm']), makefile_test, ['T18815']) +test('T18668', normal, compile, ['-dsuppress-uniques']) test('T18995', [ grep_errmsg(r'print') ], compile, ['-O -ddump-simpl -dsuppress-uniques']) |