This is an archive of the discontinued LLVM Phabricator instance.

Add an option to disable tail-call optimization for escaping blocks
AbandonedPublic

Authored by ahatanak on Feb 27 2018, 4:09 PM.

Details

Reviewers
rjmccall
Summary

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

Diff Detail

Event Timeline

ahatanak created this revision.Feb 27 2018, 4:09 PM

Add cfe-commits to subscribers.

ahatanak abandoned this revision.Feb 27 2018, 4:20 PM

I'm going to send this patch again so that people can read the summary.

Abandon this one, then, please.

This one is abandoned. The new phab review is here:

https://reviews.llvm.org/D43841

Oh, sorry, somehow I missed that it was abandoned.