[PATCH] D82085: [TRE] markTails marks call sites as tailcalls though some of them are not.

Eli Friedman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 18 14:15:08 PDT 2020


efriedma added a comment.

All "tail" needs to mean is "this call does not reference the current function's stack."  That's all, no more or less.

The relevant documentation and APIs are a bit confusing.  A "tail" marking is a prerequisite for tailcall optimization, but it's not really related to any of the other prerequisites for tailcall optimization.  Dropping the "tail" marking just because the call isn't in a tail position would involve a bunch of work adding and removing "tail" markings, for no benefit.

It makes sense to teach tail recursion elimination not to depend so heavily on tail markings.  But I don't think that implies we want to mess with the markings themselves.

> I think the confusion happened exactly because "tail" marking was done for all calls(not for the real tailcalls).

I don't think there's any confusion here.  It's just using the tail markings as a conservative estimate of capturing because it has to compute them anyway.  And TRE in general is simplistic code that nobody has spent much time looking at in a long time.  There are very few TRE opportunities in C/C++ code anyway.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D82085/new/

https://reviews.llvm.org/D82085





More information about the cfe-commits mailing list