[commit: ghc] wip/T13255-spj: Change -dppr-ticks to -dsuppress-ticks (e562ff3)

git at git.haskell.org git at git.haskell.org
Fri Feb 17 15:09:05 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/T13255-spj
Link       : http://ghc.haskell.org/trac/ghc/changeset/e562ff3021052d0d731888d94e8ed4c3485ebbfd/ghc

>---------------------------------------------------------------

commit e562ff3021052d0d731888d94e8ed4c3485ebbfd
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Fri Feb 17 14:50:59 2017 +0000

    Change -dppr-ticks to -dsuppress-ticks
    
    I spent about two hours today hunting fruitlessly for a simplifier
    bug (when fixing Trac #13255), only to find that it was caused by
    -ddump-X silently suppressing all ticks in Core.
    
    I think this has happened to me once before.
    
    So I've changed to make tick-printing on by default (like coercions,
    etc), with a flag -dsuppress-ticks (like -dsuppress-coercions) to
    suppress them.
    
    Blargh.
    
    -dppr-ticks is still there, but deprecated.


>---------------------------------------------------------------

e562ff3021052d0d731888d94e8ed4c3485ebbfd
 compiler/cmm/PprCmm.hs                          | 7 +++----
 compiler/coreSyn/PprCore.hs                     | 6 +++---
 compiler/main/DynFlags.hs                       | 8 ++++++--
 compiler/stgSyn/StgSyn.hs                       | 6 +++---
 docs/users_guide/debugging.rst                  | 8 ++++----
 testsuite/tests/codeGen/should_compile/Makefile | 4 ++--
 6 files changed, 21 insertions(+), 18 deletions(-)

diff --git a/compiler/cmm/PprCmm.hs b/compiler/cmm/PprCmm.hs
index 089066a..d20f013 100644
--- a/compiler/cmm/PprCmm.hs
+++ b/compiler/cmm/PprCmm.hs
@@ -186,15 +186,14 @@ pprNode node = pp_node <+> pp_debug
       -- label:
       CmmEntry id tscope -> ppr id <> colon <+>
          (sdocWithDynFlags $ \dflags ->
-           ppWhen (gopt Opt_PprShowTicks dflags) (text "//" <+> ppr tscope))
+           ppUnless (gopt Opt_SuppressTicks dflags) (text "//" <+> ppr tscope))
 
       -- // text
       CmmComment s -> text "//" <+> ftext s
 
       -- //tick bla<...>
-      CmmTick t -> if gopt Opt_PprShowTicks dflags
-                   then text "//tick" <+> ppr t
-                   else empty
+      CmmTick t -> ppUnless (gopt Opt_SuppressTicks dflags) $
+                   text "//tick" <+> ppr t
 
       -- unwind reg = expr;
       CmmUnwind regs ->
diff --git a/compiler/coreSyn/PprCore.hs b/compiler/coreSyn/PprCore.hs
index a8dc217..994c237 100644
--- a/compiler/coreSyn/PprCore.hs
+++ b/compiler/coreSyn/PprCore.hs
@@ -274,9 +274,9 @@ ppr_expr add_par (Let bind expr)
 
 ppr_expr add_par (Tick tickish expr)
   = sdocWithDynFlags $ \dflags ->
-  if gopt Opt_PprShowTicks dflags
-  then add_par (sep [ppr tickish, pprCoreExpr expr])
-  else ppr_expr add_par expr
+  if gopt Opt_SuppressTicks dflags
+  then ppr_expr add_par expr
+  else add_par (sep [ppr tickish, pprCoreExpr expr])
 
 pprCoreAlt :: OutputableBndr a => (AltCon, [a] , Expr a) -> SDoc
 pprCoreAlt (con, args, rhs)
diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs
index e04d408..d3d0ac3 100644
--- a/compiler/main/DynFlags.hs
+++ b/compiler/main/DynFlags.hs
@@ -545,6 +545,7 @@ data GeneralFlag
    -- Except for uniques, as some simplifier phases introduce new
    -- variables that have otherwise identical names.
    | Opt_SuppressUniques
+   | Opt_SuppressTicks     -- Replaces Opt_PprShowTicks
 
    -- temporary flags
    | Opt_AutoLinkPackages
@@ -2829,6 +2830,7 @@ dynamic_flags_deps = [
                   setGeneralFlag Opt_SuppressModulePrefixes
                   setGeneralFlag Opt_SuppressTypeApplications
                   setGeneralFlag Opt_SuppressIdInfo
+                  setGeneralFlag Opt_SuppressTicks
                   setGeneralFlag Opt_SuppressTypeSignatures)
 
         ------ Debugging ----------------------------------------------------
@@ -3586,7 +3588,9 @@ dFlagsDeps = [
 -- See Note [Supporting CLI completion]
 -- Please keep the list of flags below sorted alphabetically
   flagSpec "ppr-case-as-let"            Opt_PprCaseAsLet,
-  flagSpec "ppr-ticks"                  Opt_PprShowTicks,
+  depFlagSpec' "ppr-ticks"              Opt_PprShowTicks
+     (\turn_on -> useInstead "suppress-ticks" (not turn_on)),
+  flagSpec "suppress-ticks"             Opt_SuppressTicks,
   flagSpec "suppress-coercions"         Opt_SuppressCoercions,
   flagSpec "suppress-idinfo"            Opt_SuppressIdInfo,
   flagSpec "suppress-unfoldings"        Opt_SuppressUnfoldings,
@@ -3677,7 +3681,7 @@ fFlagsDeps = [
   flagSpec "regs-graph"                       Opt_RegsGraph,
   flagSpec "regs-iterative"                   Opt_RegsIterative,
   depFlagSpec' "rewrite-rules"                Opt_EnableRewriteRules
-    (useInstead "enable-rewrite-rules"),
+   (useInstead "enable-rewrite-rules"),
   flagSpec "shared-implib"                    Opt_SharedImplib,
   flagSpec "spec-constr"                      Opt_SpecConstr,
   flagSpec "specialise"                       Opt_Specialise,
diff --git a/compiler/stgSyn/StgSyn.hs b/compiler/stgSyn/StgSyn.hs
index 93b6e76..15181f3 100644
--- a/compiler/stgSyn/StgSyn.hs
+++ b/compiler/stgSyn/StgSyn.hs
@@ -766,9 +766,9 @@ pprStgExpr (StgLetNoEscape bind expr)
 
 pprStgExpr (StgTick tickish expr)
   = sdocWithDynFlags $ \dflags ->
-    if gopt Opt_PprShowTicks dflags
-    then sep [ ppr tickish, pprStgExpr expr ]
-    else pprStgExpr expr
+    if gopt Opt_SuppressTicks dflags
+    then pprStgExpr expr
+    else sep [ ppr tickish, pprStgExpr expr ]
 
 
 pprStgExpr (StgCase expr bndr alt_type alts)
diff --git a/docs/users_guide/debugging.rst b/docs/users_guide/debugging.rst
index fc634d0..fd4adc7 100644
--- a/docs/users_guide/debugging.rst
+++ b/docs/users_guide/debugging.rst
@@ -267,10 +267,6 @@ Dumping out compiler intermediate structures
     aren't). This flag makes debugging output appear in the more verbose
     debug style.
 
-.. ghc-flag:: -dppr-ticks
-
-    Includes "ticks" in the pretty-printer output.
-
 
 .. _formatting dumps:
 
@@ -323,6 +319,10 @@ parts that you are not interested in.
     this often makes the printout ambiguous. If you just want to see the
     overall structure of the code, then start here.
 
+.. ghc-flag:: -dsuppress-ticks
+
+    Suppress "ticks" in the pretty-printer output.
+
 .. ghc-flag:: -dsuppress-uniques
 
     Suppress the printing of uniques. This may make the printout
diff --git a/testsuite/tests/codeGen/should_compile/Makefile b/testsuite/tests/codeGen/should_compile/Makefile
index fda9c94..a3e03d2 100644
--- a/testsuite/tests/codeGen/should_compile/Makefile
+++ b/testsuite/tests/codeGen/should_compile/Makefile
@@ -9,13 +9,13 @@ debug:
 	# Without optimisations, we should get annotations for basically
 	# all expressions in the example program.
 	echo == Dbg ==
-	'$(TEST_HC)' $(TEST_HC_OPTS) debug -fforce-recomp -g -dppr-ticks -ddump-cmm-verbose \
+	'$(TEST_HC)' $(TEST_HC_OPTS) debug -fforce-recomp -g -ddump-cmm-verbose \
 		| grep -o src\<debug.hs:.*\> | sort -u
 	./debug
 
 	# With optimisations we will get fewer annotations.
 	echo == Dbg -O2 ==
-	'$(TEST_HC)' $(TEST_HC_OPTS) debug -fforce-recomp -g -dppr-ticks -ddump-cmm-verbose -O2 \
+	'$(TEST_HC)' $(TEST_HC_OPTS) debug -fforce-recomp -g -ddump-cmm-verbose -O2 \
 		> debug.cmm
 	cat debug.cmm | grep -o src\<debug.hs:.*\> | sort -u
 



More information about the ghc-commits mailing list