summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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