[PATCH] D60074: [Attributor] Deduce "no-recurse" function attribute

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 5 17:59:25 PDT 2019


efriedma added a comment.

Is it actually correct to derive norecurse like this?

Suppose I have two functions:

  void f(int x) { if (x) { g(); } }
  void g() { f(0); }

As far as I can tell, it would be correct to mark g() norecurse.  And if g() is marked norecurse, we'll mark f() norecurse, which is wrong.

Granted, this is being sort of pedantic with the definition in LangRef, which says the function "does not call itself".  It might make sense to redefine norecurse to mean the function doesn't call "any function currently on the stack", instead of just itself.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D60074





More information about the llvm-commits mailing list