[commit: ghc] master: Fix optimization of Parser.y.pp (9f8e9d2)

git at git.haskell.org git at git.haskell.org
Mon Sep 9 18:45:40 CEST 2013


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/9f8e9d29c1c6e4e031469efcfbdae508dd6540e7/ghc

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

commit 9f8e9d29c1c6e4e031469efcfbdae508dd6540e7
Author: Austin Seipp <aseipp at pobox.com>
Date:   Mon Sep 9 10:42:55 2013 -0500

    Fix optimization of Parser.y.pp
    
    In 9e133b, the build was modified to pass -fcmm-sink to Parser, but
    unfortunately Parser specifies -O0 in its OPTIONS_GHC directive, meaning
    the sinking pass was actually turned off.
    
    HC_OPTS is the last thing passed to the compiler for that source file
    however, so the correct fix is to also move -O0 out into the build
    system as well.
    
    This was uncovered thanks to a build report from Kazu Yamamoto. Thanks
    to Jan Stolarek for eyeballing this bug and finding it.
    
    Signed-off-by: Austin Seipp <aseipp at pobox.com>


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

9f8e9d29c1c6e4e031469efcfbdae508dd6540e7
 compiler/ghc.mk             |   15 +++++++++------
 compiler/parser/Parser.y.pp |    8 --------
 2 files changed, 9 insertions(+), 14 deletions(-)

diff --git a/compiler/ghc.mk b/compiler/ghc.mk
index 1149fbd..770f580 100644
--- a/compiler/ghc.mk
+++ b/compiler/ghc.mk
@@ -341,20 +341,23 @@ else
 compiler_CONFIGURE_OPTS += --ghc-option=-DNO_REGS
 endif
 
+# Careful optimisation of the parser: we don't want to throw everything
+# at it, because that takes too long and doesn't buy much, but we do want
+# to inline certain key external functions, so we instruct GHC not to
+# throw away inlinings as it would normally do in -O0 mode.
+compiler/stage1/build/Parser_HC_OPTS += -O0 -fno-ignore-interface-pragmas
 # If we're bootstrapping the compiler during stage2, or we're being
 # built by a GHC whose version is > 7.8, we need -fcmm-sink to be
 # passed to the compiler. This is required on x86 to avoid the
 # register allocator running out of stack slots when compiling this
 # module with -fPIC -dynamic.
+# See #8182 for all the details
 ifeq "$(CMM_SINK_BOOTSTRAP_IS_NEEDED)" "YES"
 compiler/stage1/build/Parser_HC_OPTS += -fcmm-sink
 endif
-# However, we may be using e.g. 7.6, and thus the bootstrap compiler
-# does not need to pass -fcmm-sink, but stage1+ does!
-# We pass -fcmm-sink to every stage != 1
-# See #8182 for all the details
-compiler/stage2/build/Parser_HC_OPTS += -fcmm-sink
-compiler/stage3/build/Parser_HC_OPTS += -fcmm-sink
+# We also pass -fcmm-sink to every stage != 1
+compiler/stage2/build/Parser_HC_OPTS += -O0 -fno-ignore-interface-pragmas -fcmm-sink
+compiler/stage3/build/Parser_HC_OPTS += -O0 -fno-ignore-interface-pragmas -fcmm-sink
 
 
 ifeq "$(GhcProfiled)" "YES"
diff --git a/compiler/parser/Parser.y.pp b/compiler/parser/Parser.y.pp
index b18d0d3..bd2bd0b 100644
--- a/compiler/parser/Parser.y.pp
+++ b/compiler/parser/Parser.y.pp
@@ -16,14 +16,6 @@
 --     http://hackage.haskell.org/trac/ghc/wiki/Commentary/CodingStyle#Warnings
 -- for details
 
-{-# OPTIONS_GHC -O0 -fno-ignore-interface-pragmas #-}
-{-
-Careful optimisation of the parser: we don't want to throw everything
-at it, because that takes too long and doesn't buy much, but we do want
-to inline certain key external functions, so we instruct GHC not to
-throw away inlinings as it would normally do in -O0 mode.
--}
-
 module Parser ( parseModule, parseStmt, parseIdentifier, parseType,
                 parseHeader ) where
 





More information about the ghc-commits mailing list