[llvm-dev] How to prevent optimizing away a call + its arguments

Joerg Sonnenberger via llvm-dev llvm-dev at lists.llvm.org
Thu Jun 22 10:45:08 PDT 2017


On Thu, Jun 22, 2017 at 05:35:51PM +0000, David Blaikie wrote:
> optnone should work, but really noinline should probably (Chandler: Can you
> confirm: is it reasonable to model noinline as "no interprocedural analysis
> across this function boundary" (so FunctionAttrs should do the same thing
> for noinline as it does for optnone, for example? ie: not derive any new
> attributes) - allowing the function to be optimized internally (unlike
> optnone) but not allowing interprocedural analysis inside the function to
> be used in callers (unlike optnone)) work as well?

I don't think it is reasonable to expect "noinline" to mean "must not do
IPA". There are different reasons for using "noinline": ensuring a stack
frame, forcing outlining of "cold" code etc. Many of those reasons are
perfectly fine to still allow IPA. Debug hooks fall into two categories:
making sure that the call happens (noinline should allow that) and
making sure that the debugger can actually do something at this point
(noinline should not have to allow that).

Joerg


More information about the llvm-dev mailing list