Commit ba52053b authored by dterei's avatar dterei

Add '-fllvm-tbaa' flag for controlling LLVM TBAA opt.

parent c55bb603
......@@ -1306,15 +1306,18 @@ runPhase SplitAs _input_fn dflags
runPhase LlvmOpt input_fn dflags
= do
let lo_opts = getOpts dflags opt_lo
let opt_lvl = max 0 (min 2 $ optLevel dflags)
-- don't specify anything if user has specified commands. We do this for
-- opt but not llc since opt is very specifically for optimisation 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.
let optFlag = if null lo_opts
then [SysTools.Option (llvmOpts !! opt_lvl)]
else []
let lo_opts = getOpts dflags opt_lo
opt_lvl = max 0 (min 2 $ optLevel dflags)
-- don't specify anything if user has specified commands. We do this
-- for opt but not llc since opt is very specifically for optimisation
-- 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 lo_opts
then [SysTools.Option (llvmOpts !! opt_lvl)]
else []
tbaa | dopt Opt_LlvmTBAA dflags = "--enable-tbaa=true"
| otherwise = "--enable-tbaa=false"
output_fn <- phaseOutputFilename LlvmLlc
......@@ -1323,6 +1326,7 @@ runPhase LlvmOpt input_fn dflags
SysTools.Option "-o",
SysTools.FileOption "" output_fn]
++ optFlag
++ [SysTools.Option tbaa]
++ map SysTools.Option lo_opts)
return (LlvmLlc, output_fn)
......@@ -1341,6 +1345,8 @@ runPhase LlvmLlc input_fn dflags
rmodel | opt_PIC = "pic"
| not opt_Static = "dynamic-no-pic"
| otherwise = "static"
tbaa | dopt Opt_LlvmTBAA dflags = "--enable-tbaa=true"
| otherwise = "--enable-tbaa=false"
-- hidden debugging flag '-dno-llvm-mangler' to skip mangling
let next_phase = case dopt Opt_NoLlvmMangler dflags of
......@@ -1356,6 +1362,7 @@ runPhase LlvmLlc input_fn dflags
SysTools.FileOption "" input_fn,
SysTools.Option "-o", SysTools.FileOption "" output_fn]
++ map SysTools.Option lc_opts
++ [SysTools.Option tbaa]
++ map SysTools.Option fpOpts)
return (next_phase, output_fn)
......@@ -1373,7 +1380,7 @@ runPhase LlvmLlc input_fn dflags
else if (elem VFPv3D16 ext)
then ["-mattr=+v7,+vfp3,+d16"]
else []
_ -> []
_ -> []
-----------------------------------------------------------------------------
-- LlvmMangle phase
......
......@@ -250,6 +250,7 @@ data DynFlag
| Opt_RegsGraph -- do graph coloring register allocation
| Opt_RegsIterative -- do iterative coalescing graph coloring register allocation
| Opt_PedanticBottoms -- Be picky about how we treat bottom
| Opt_LlvmTBAA -- Use LLVM TBAA infastructure for improving AA
-- Interface files
| Opt_IgnoreInterfacePragmas
......@@ -1823,6 +1824,7 @@ fFlags = [
( "vectorise", Opt_Vectorise, nop ),
( "regs-graph", Opt_RegsGraph, nop ),
( "regs-iterative", Opt_RegsIterative, nop ),
( "llvm-tbaa", Opt_LlvmTBAA, nop),
( "gen-manifest", Opt_GenManifest, nop ),
( "embed-manifest", Opt_EmbedManifest, nop ),
( "ext-core", Opt_EmitExternalCore, nop ),
......@@ -2071,6 +2073,7 @@ optLevelFlags
, ([2], Opt_LiberateCase)
, ([2], Opt_SpecConstr)
, ([2], Opt_RegsGraph)
, ([0,1,2], Opt_LlvmTBAA)
-- , ([2], Opt_StaticArgumentTransformation)
-- Max writes: I think it's probably best not to enable SAT with -O2 for the
......
......@@ -1545,6 +1545,15 @@
<entry><option>-fno-liberate-case-threshold</option></entry>
</row>
<row>
<entry><option>-fllvm-tbaa</replaceable></entry>
<entry>Turn on Typed Based Alias Analysis information in the LLVM
backend. This enables more accurate and alias information in the LLVM
backend for better optimisation. (default: Enabled)</entry>
<entry>dynamic</entry>
<entry><option>-fno-llvm-tbaa</option></entry>
</row>
<row>
<entry><option>-fmax-simplifier-iterations</option></entry>
<entry>Set the max iterations for the simplifier</entry>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment