Optimisation flags at -O0

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Optimisation flags at -O0

Heller Time
I wanted to understand better what `-fspec-constr` does.

So I compiled the User Guide example with `-O0 -fspec-constr` to isolate
the effects of call-pattern specialization, and nothing else (I used
ghc-core to pretty-print the resulting Core syntax).

It appears I get the same output wether I use `-fspec-constr` or not.

Does this mean that compiling with `-O0` even explicitly enabled
optimizations are turned off?

If that is the case, how does one test an isolated optimization?

-Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/ghc-devs/attachments/20140105/316787ee/attachment.html>

Reply | Threaded
Open this post in threaded view
|

Optimisation flags at -O0

Edward Z. Yang
All -f flags have a 'no' form, as in '-fno-spec-constr', so you can
manually toggle a single optimization on/off.  Some optimizations apply
even at -O0, see optLevelFlags in compiler/main/DynFlags.hs

Edward

Excerpts from Chris Heller's message of 2014-01-05 18:43:46 -0800:

> I wanted to understand better what `-fspec-constr` does.
>
> So I compiled the User Guide example with `-O0 -fspec-constr` to isolate
> the effects of call-pattern specialization, and nothing else (I used
> ghc-core to pretty-print the resulting Core syntax).
>
> It appears I get the same output wether I use `-fspec-constr` or not.
>
> Does this mean that compiling with `-O0` even explicitly enabled
> optimizations are turned off?
>
> If that is the case, how does one test an isolated optimization?
>
> -Chris

Reply | Threaded
Open this post in threaded view
|

Optimisation flags at -O0

Simon Peyton Jones
In reply to this post by Heller Time
It appears I get the same output wether I use `-fspec-constr` or not.

I'm afraid so.  Look in simplCore/SimplCore.lhs, function getCoreToDo.  This builds the main optimisation pipeline.  You'll see that it has a -O0 path and a -O1/-O2 path.  The flag Opt_SpecConstr is consulted only in the latter.

One could perhaps do it differently but that's the way it is right now.

I test an isolated optimisation by switching it on and off with -O1.

Simon

From: ghc-devs [mailto:ghc-devs-bounces at haskell.org] On Behalf Of Chris Heller
Sent: 06 January 2014 02:44
To: ghc-devs at haskell.org
Subject: Optimisation flags at -O0

I wanted to understand better what `-fspec-constr` does.

So I compiled the User Guide example with `-O0 -fspec-constr` to isolate the effects of call-pattern specialization, and nothing else (I used ghc-core to pretty-print the resulting Core syntax).

It appears I get the same output wether I use `-fspec-constr` or not.

Does this mean that compiling with `-O0` even explicitly enabled optimizations are turned off?

If that is the case, how does one test an isolated optimization?

-Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/ghc-devs/attachments/20140109/eb86164a/attachment-0001.html>