<div dir="ltr">Hi David,<div><br></div><div>There was some discussion here that caused me to go down this route: <a href="http://reviews.llvm.org/D14148">http://reviews.llvm.org/D14148</a> . There are a couple of reasons why I think this is better as an attribute than an analysis, although I'm not strongly opposed to it being an analysis instead.</div><div><br></div><div>* Analyses are easy to clobber, hard to preserve. The chances of having to recompute this information when needed is high. This is a weak argument in and of itself, though.</div><div>* Norecurse does actually model language features. OpenCL mandates no recursion, so all of its BIFLs could be annotated with this so that optimizatons on non-recursive functions can take place even when BIFLs aren't available (function prototypes only).</div><div>* In C++, "main" is non-recursive. This is not the case in C, and there is a longstanding gratuitous hack in GlobalOpt that completely breaks C in favour of C++ by string-matching "main". This attribute allows us to have Clang tell the backend this information in a language-safe manner.</div><div><br></div><div>Cheers,</div><div><br></div><div>James</div></div><br><div class="gmail_quote"><div dir="ltr">On Mon, 2 Nov 2015 at 16:41 David Blaikie via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Nov 2, 2015 at 5:03 AM, James Molloy via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">jmolloy created this revision.<br>
jmolloy added reviewers: manmanren, dexonsmith, joker.eph.<br>
jmolloy added a subscriber: llvm-commits.<br>
jmolloy set the repository for this revision to rL LLVM.<br>
<br>
This attribute allows the compiler to assume that the function never recurses into itself, either directly or indirectly (transitively). This can be used among other things to demote global variables to locals.<br></blockquote><div><br></div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>Where would this attribute generally come from? Is it expected that this would be exposed as a source language attribute? (any prior art there?)<br>Otherwise wouldn't this be an LLVM analysis, rather than a first-class IR feature?</div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
The norecurse attribute indicates that the function does not call itself either directly or indirectly down any possible call path.<br>
<br>
Repository:<br>
  rL LLVM<br>
<br>
<a href="http://reviews.llvm.org/D14227" rel="noreferrer" target="_blank">http://reviews.llvm.org/D14227</a><br>
<br>
Files:<br>
  docs/LangRef.rst<br>
  include/llvm/Bitcode/LLVMBitCodes.h<br>
  include/llvm/IR/Attributes.h<br>
  include/llvm/IR/Function.h<br>
  lib/AsmParser/LLLexer.cpp<br>
  lib/AsmParser/LLParser.cpp<br>
  lib/AsmParser/LLToken.h<br>
  lib/Bitcode/Reader/BitcodeReader.cpp<br>
  lib/Bitcode/Writer/BitcodeWriter.cpp<br>
  lib/IR/Attributes.cpp<br>
  lib/IR/Verifier.cpp<br>
  test/Bindings/llvm-c/invalid-bitcode.test<br>
  test/Bitcode/attributes.ll<br>
  test/Bitcode/compatibility.ll<br>
  test/Bitcode/invalid.ll<br>
  test/LTO/X86/invalid.ll<br>
<br>
<br>_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
<br></blockquote></div></div></div>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div>