[PATCH] D14227: Add a new attribute: norecurse

Mehdi Amini via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 2 11:09:12 PST 2015


> On Nov 2, 2015, at 8:41 AM, David Blaikie <dblaikie at gmail.com> wrote:
> 
> 
> 
> On Mon, Nov 2, 2015 at 5:03 AM, James Molloy via llvm-commits <llvm-commits at lists.llvm.org <mailto:llvm-commits at lists.llvm.org>> wrote:
> jmolloy created this revision.
> jmolloy added reviewers: manmanren, dexonsmith, joker.eph.
> jmolloy added a subscriber: llvm-commits.
> jmolloy set the repository for this revision to rL LLVM.
> 
> 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.
> 
> Where would this attribute generally come from? Is it expected that this would be exposed as a source language attribute? (any prior art there?)
> Otherwise wouldn't this be an LLVM analysis, rather than a first-class IR feature?

The advantage of the attribute vs IR feature is that some higher level representation can populate this when generating the IR. Use cases like SIL, or the Matlab (or Julia, or Rust, or ...) generator for instance could have more information to infer this attribute than an analysis have on the pure LLVM IR semantic. Maybe the Java generator could benefit from this? (CC Sanjoy/Philip).
The attribute does not prevent an analysis that would be able populate this attribute when it is possible to infer this on the IR.
It is true that we don’t really have much data (other than the C++ main case) to support this.

— 
Mehdi



>  
> 
> The norecurse attribute indicates that the function does not call itself either directly or indirectly down any possible call path.
> 
> Repository:
>   rL LLVM
> 
> http://reviews.llvm.org/D14227 <http://reviews.llvm.org/D14227>
> 
> Files:
>   docs/LangRef.rst
>   include/llvm/Bitcode/LLVMBitCodes.h
>   include/llvm/IR/Attributes.h
>   include/llvm/IR/Function.h
>   lib/AsmParser/LLLexer.cpp
>   lib/AsmParser/LLParser.cpp
>   lib/AsmParser/LLToken.h
>   lib/Bitcode/Reader/BitcodeReader.cpp
>   lib/Bitcode/Writer/BitcodeWriter.cpp
>   lib/IR/Attributes.cpp
>   lib/IR/Verifier.cpp
>   test/Bindings/llvm-c/invalid-bitcode.test
>   test/Bitcode/attributes.ll
>   test/Bitcode/compatibility.ll
>   test/Bitcode/invalid.ll
>   test/LTO/X86/invalid.ll
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org <mailto:llvm-commits at lists.llvm.org>
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits <http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151102/c64a4190/attachment.html>


More information about the llvm-commits mailing list