| Is -O required for optimization across module bounds?

Yes, without -O GHC doesn’t put inlinings into interface files, so an importing 
module can't see them.  Use -fno-omit-interface-pragmas to tell GHC to put the 
stuff in the interface file regardless.

| Also, since I really want a certain level of inlining for a plugin I'm
| working on; is there a way to force (from the plugin, i.e. using the
| API) to force inlining of a term at its call-site?

Yes, use the magic function 'inline'.  
http://www.haskell.org/ghc/docs/7.8.2/html/libraries/base-4.7.0.0/GHC-Exts.html#v%3Ainline
(But I don’t know how much people have exercised this recently, and I think 
it's a bit fragile because it vanishes after a single inlining.)

| Alternatively
| (weaker), can I force - from a compiler plugin - the inliner to behave
| as if -O was set even if it wasn't?

Well, you could invoke the simplifier from the plugin, setting the DynFlags to 
-O first.  But I don’t think the plugin can side-effect the DynFlags for 
downstream passes.

Simon

_______________________________________________
ghc-devs mailing list
ghc-devs@haskell.org
http://www.haskell.org/mailman/listinfo/ghc-devs

Reply via email to