summaryrefslogtreecommitdiff
path: root/compiler/main/DriverPipeline.hs
diff options
context:
space:
mode:
authorBen Gamari <bgamari.foss@gmail.com>2014-03-06 21:20:02 +0100
committerAustin Seipp <austin@well-typed.com>2014-03-13 17:56:36 -0500
commitb84b5da4430aacd5bf8422b06a861cd0584f99cf (patch)
tree48ce6e0fcaf2add3c6011af9d8d77851a40ce1eb /compiler/main/DriverPipeline.hs
parentd574fcbba09fd6c9d10a79e19daf5f15bb0a6cde (diff)
downloadhaskell-b84b5da4430aacd5bf8422b06a861cd0584f99cf.tar.gz
DriverPipeline: Ensure -globalopt is passed to LLVM opt
While -O1 and -O2 both include -globalopt, the order in which the passes are run means that aliases aren't resolved which then causes llc to fall over. See GHC bug #8855. Signed-off-by: Austin Seipp <austin@well-typed.com>
Diffstat (limited to 'compiler/main/DriverPipeline.hs')
-rw-r--r--compiler/main/DriverPipeline.hs8
1 files changed, 6 insertions, 2 deletions
diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs
index f6d9e03ac3..564edd27f7 100644
--- a/compiler/main/DriverPipeline.hs
+++ b/compiler/main/DriverPipeline.hs
@@ -1337,7 +1337,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 map SysTools.Option $ words (llvmOpts !! opt_lvl)
+ then map SysTools.Option $ words (llvmOpts ver !! opt_lvl)
else []
tbaa | ver < 29 = "" -- no tbaa in 2.8 and earlier
| gopt Opt_LlvmTBAA dflags = "--enable-tbaa=true"
@@ -1357,7 +1357,11 @@ 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 -globalopt", "-O1", "-O2"]
+ llvmOpts ver = [ "-mem2reg -globalopt"
+ , if ver >= 34 then "-O1 -globalopt" else "-O1"
+ -- LLVM 3.4 -O1 doesn't eliminate aliases reliably (bug #8855)
+ , "-O2"
+ ]
-----------------------------------------------------------------------------
-- LlvmLlc phase