[commit: ghc] master: Always have LLVM optimize globals (a421252)

David Terei davidterei at gmail.com
Sat Jul 6 02:00:48 CEST 2013


Repository : http://darcs.haskell.org/ghc.git/

On branch  : master

https://github.com/ghc/ghc/commit/a42125243ac1cb0f05d93d58e6d2818d742501ee

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

commit a42125243ac1cb0f05d93d58e6d2818d742501ee
Author: Peter Wortmann <scpmw at leeds.ac.uk>
Date:   Tue Jul 2 23:42:27 2013 +0100

    Always have LLVM optimize globals
    
    This pass is pretty cheap and eliminates the aliases generated by the LLVM
    backend. This in turn is required for dynamic linking to work correctly,
    as LLVM fails to properly attribute calls to aliased addresses.
    
    Signed-off-by: David Terei <davidterei at gmail.com>

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

 compiler/main/DriverPipeline.hs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs
index 7ceccef..67377e6 100644
--- a/compiler/main/DriverPipeline.hs
+++ b/compiler/main/DriverPipeline.hs
@@ -1378,7 +1378,7 @@ runPhase (RealPhase LlvmOpt) input_fn dflags
         -- passes only, so if the user is passing us extra options we assume
         -- they know what they are doing and don't get in the way.
         optFlag  = if null (getOpts dflags opt_lo)
-                       then [SysTools.Option (llvmOpts !! opt_lvl)]
+                       then map SysTools.Option $ words (llvmOpts !! opt_lvl)
                        else []
         tbaa | ver < 29                 = "" -- no tbaa in 2.8 and earlier
              | gopt Opt_LlvmTBAA dflags = "--enable-tbaa=true"
@@ -1398,7 +1398,7 @@ runPhase (RealPhase LlvmOpt) input_fn dflags
   where 
         -- we always (unless -optlo specified) run Opt since we rely on it to
         -- fix up some pretty big deficiencies in the code we generate
-        llvmOpts = ["-mem2reg", "-O1", "-O2"]
+        llvmOpts = ["-mem2reg -globalopt", "-O1", "-O2"]
 
 -----------------------------------------------------------------------------
 -- LlvmLlc phase





More information about the ghc-commits mailing list