[Attr] Add "willreturn" function attribute
authorJohannes Doerfert <jdoerfert@anl.gov>
Thu, 27 Jun 2019 15:51:40 +0000 (15:51 +0000)
committerJohannes Doerfert <jdoerfert@anl.gov>
Thu, 27 Jun 2019 15:51:40 +0000 (15:51 +0000)
commit3b77583e95236761d8741fd6df375975a8ca5d83
tree62368c6f8dec79ee75d295c2d39c31d41a9646e8
parent7d8274d54d0305b827e87adae4619abd6433043c
[Attr] Add "willreturn" function attribute

This patch introduces a new function attribute, willreturn, to indicate
that a call of this function will either exhibit undefined behavior or
comes back and continues execution at a point in the existing call stack
that includes the current invocation.

This attribute guarantees that the function does not have any endless
loops, endless recursion, or terminating functions like abort or exit.

Patch by Hideto Ueno (@uenoku)

Reviewers: jdoerfert

Subscribers: mehdi_amini, hiraditya, steven_wu, dexonsmith, lebedev.ri, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D62801

llvm-svn: 364555
13 files changed:
llvm/docs/LangRef.rst
llvm/include/llvm/Bitcode/LLVMBitCodes.h
llvm/include/llvm/IR/Attributes.td
llvm/lib/AsmParser/LLLexer.cpp
llvm/lib/AsmParser/LLParser.cpp
llvm/lib/AsmParser/LLToken.h
llvm/lib/Bitcode/Reader/BitcodeReader.cpp
llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
llvm/lib/IR/Attributes.cpp
llvm/lib/IR/Verifier.cpp
llvm/lib/Transforms/Utils/CodeExtractor.cpp
llvm/test/Bitcode/attributes.ll
llvm/test/Transforms/FunctionAttrs/willreturn.ll [new file with mode: 0644]