This revision was automatically updated to reflect the committed changes.
Closed by commit rL326530: Add an option to disable tail-call optimization for
escaping blocks. (authored by ahatanak, committed by ).
Herald added a subscriber: llvm-commits.
Changed prior to commit:
https://reviews.llvm
rjmccall accepted this revision.
rjmccall added a comment.
This revision is now accepted and ready to land.
Alright, this looks good to me.
Comment at: lib/Sema/SemaExpr.cpp:4846
+if (auto *BE = dyn_cast(Arg->IgnoreParenNoopCasts(Context)))
+ BE->getBlockDecl()
ahatanak updated this revision to Diff 136584.
ahatanak marked an inline comment as done.
ahatanak added a comment.
Check the function prototype's noescape bit.
https://reviews.llvm.org/D43841
Files:
include/clang/AST/Decl.h
include/clang/Driver/Options.td
include/clang/Frontend/CodeGenOp
ahatanak marked an inline comment as done.
ahatanak added inline comments.
Comment at: lib/Sema/SemaExpr.cpp:4846
+if (auto *BE = dyn_cast(Arg->IgnoreParenNoopCasts(Context)))
+ BE->getBlockDecl()->setDoesNotEscape();
+
rjmccall wrote:
> Can this
rjmccall added inline comments.
Comment at: lib/Sema/SemaExpr.cpp:4846
+if (auto *BE = dyn_cast(Arg->IgnoreParenNoopCasts(Context)))
+ BE->getBlockDecl()->setDoesNotEscape();
+
Can this be based on the noescape parameter bit on the function type?
ahatanak updated this revision to Diff 136580.
ahatanak marked 3 inline comments as done.
ahatanak added a comment.
Address review comments.
https://reviews.llvm.org/D43841
Files:
include/clang/AST/Decl.h
include/clang/Driver/Options.td
include/clang/Frontend/CodeGenOptions.def
lib/Code
ahatanak added inline comments.
Comment at: include/clang/Driver/Options.td:1419
+def fno_disable_tail_calls_escaping_blocks : Flag<["-"],
"fno-disable-tail-calls-escaping-blocks">, Group, Flags<[CC1Option]>;
+def fdisable_tail_calls_escaping_blocks : Flag<["-"],
"fdisable-tail
rjmccall added inline comments.
Comment at: include/clang/Driver/Options.td:1419
+def fno_disable_tail_calls_escaping_blocks : Flag<["-"],
"fno-disable-tail-calls-escaping-blocks">, Group, Flags<[CC1Option]>;
+def fdisable_tail_calls_escaping_blocks : Flag<["-"],
"fdisable-tail
rjmccall added a comment.
TCO is a pretty neglible optimization; its primary advantage is slightly better
locality for stack memory.
I guess the more compelling argument is that non-escaping blocks can by
definition only be executed with the original block-creating code still active,
so someon
ahatanak added a comment.
This is limited to escaping blocks because disabling tail-call optimizations
for all blocks might impact performance. The user is claiming that non-escaping
blocks are often used in areas that are performance-sensitive (for example,
dispatch_sync() and -[NSArray enumer
rjmccall added a comment.
Can you explain the rationale for limiting this to escaping blocks in more
depth? That seems like an extremely orthogonal limitation; the user might be
thinking about a very specific block and not really considering this in general.
https://reviews.llvm.org/D43841
ahatanak created this revision.
ahatanak added a reviewer: rjmccall.
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 sp
12 matches
Mail list logo