This patch adds a command line option (-fdisable-tail-calls-esca
ping-blocks) that annotates escaping block invoke functions with attribute "disable-tail-calls". This is an option that helps users in debugging their code who spend a lot of time trying to figure out where a block came from.
The user who is asking for this command line option does not want to disable tail-call optimization for non-escaping blocks. For example, in the following code, we should not disable tail-call optimization for the block that is directly passed to function "noescapefunc":
void foo3(void); void foo1() { noescapefunc(^{ foo3(); }); // do not disable tail-call. BlockTy b = ^{ foo3(); }; // disable tail-call. noescapefunc(b); }
Ideally, I think we want to avoid disabling tail-call optimization for block "b" too, as it doesn't escape. However, this patch doesn't do anything to avoid disabling tail-call optimization for the block, since that would require a more complex analysis.
rdar://problem/35758207
These are pretty unidiomatic option names. I would suggest one of these: