1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00
Go to file
Atmn Patel cbe95c4921 [LangRef] Define mustprogress attribute
LLVM IR currently assumes some form of forward progress. This form is
not explicitly defined anywhere, and is the cause of miscompilations
in most languages that are not C++11 or later. This implicit forward progress
guarantee can not be opted out of on a function level nor on a loop
level. Languages such as C (C11 and later), C++ (pre-C++11), and Rust
have different forward progress requirements and this needs to be
evident in the IR.

Specifically, C11 and onwards (6.8.5, Paragraph 6) states that "An
iteration statement whose controlling expression is not a constant
expression, that performs no input/output operations, does not access
volatile objects, and performs no synchronization or atomic operations
in its body, controlling expression, or (in the case of for statement)
its expression-3, may be assumed by the implementation to terminate."
C++11 and onwards does not have this assumption, and instead assumes
that every thread must make progress as defined in [intro.progress] when
it comes to scheduling.

This was initially brought up in [0] as a bug, a solution was presented
in [1] which is the current workaround, and the predecessor to this
change was [2].

After defining a notion of forward progress for IR, there are two
options to address this:
1) Set the default to assuming Forward Progress and provide an opt-out for functions and an opt-in for loops.
2) Set the default to not assuming Forward Progress and provide an opt-in for functions, and an opt-in for loops.

Option 2) has been selected because only C++11 and onwards have a
forward progress requirement and it makes sense for them to opt-into it
via the defined `mustprogress` function attribute.  The `mustprogress`
function attribute indicates that the function is required to make
forward progress as defined. This is sharply in contrast to the status
quo where this is implicitly assumed. In addition, `willreturn` implies `mustprogress`.

The background for why this definition was chosen is in [3] and for why
the option was chosen is in [4] and the corresponding thread(s). The implementation is in D85393, the
clang patch is in D86841, the LoopDeletion patch is in D86844, the
Inliner patches are in D87180 and D87262, and there will be more
incoming.

[0] https://bugs.llvm.org/show_bug.cgi?id=965#c25
[1] https://lists.llvm.org/pipermail/llvm-dev/2017-October/118558.html
[2] https://reviews.llvm.org/D65718
[3] https://lists.llvm.org/pipermail/llvm-dev/2020-September/144919.html
[4] https://lists.llvm.org/pipermail/llvm-dev/2020-September/145023.html

Reviewed By: jdoerfert, efriedma, nikic

Differential Revision: https://reviews.llvm.org/D86233
2020-10-19 13:34:27 -04:00
benchmarks
bindings [bindings/go] Fix TestAttributes after D88241 2020-09-25 20:31:45 -07:00
cmake [cmake] Limit missing external lit warning to be shown once 2020-10-13 21:03:49 -07:00
docs [LangRef] Define mustprogress attribute 2020-10-19 13:34:27 -04:00
examples [ORC] Break up C-API header Orc.h, and add JITEventListener support. 2020-10-19 01:59:04 -07:00
include [DAGCombiner][PowerPC] Remove isMulhCheaperThanMulShift TLI hook, Use isOperationLegalOrCustom directly instead. 2020-10-19 12:23:04 -05:00
lib [DAGCombiner][PowerPC] Remove isMulhCheaperThanMulShift TLI hook, Use isOperationLegalOrCustom directly instead. 2020-10-19 12:23:04 -05:00
projects
resources
runtimes [CMake] Don't use CMakePushCheckState 2020-10-02 17:13:34 -07:00
test [SCEV] Add tests where assumes can be used to improve tripe multiple. 2020-10-19 18:26:09 +01:00
tools [llvm] Make obj2yaml and yaml2obj LLVM utilities instead of tools 2020-10-19 10:21:21 -07:00
unittests [ML] Add final reward logging facility. 2020-10-19 08:44:50 -07:00
utils [LangRef] Define mustprogress attribute 2020-10-19 13:34:27 -04:00
.clang-format
.clang-tidy - Update .clang-tidy to ignore parameters of main like functions for naming violations in clang and llvm directory 2020-01-31 16:49:45 +00:00
.gitattributes
.gitignore [clangd] Store index in '.cache/clangd/index' instead of '.clangd/index' 2020-07-07 14:53:45 +02:00
CMakeLists.txt Guard find_library(tensorflow_c_api ...) by checking for TENSORFLOW_C_LIB_PATH to be set by the user 2020-09-28 22:15:55 +00:00
CODE_OWNERS.TXT [CSKY 1/n] Add basic stub or infra of csky backend 2020-10-10 10:44:08 +08:00
configure
CREDITS.TXT [NFC] Add contributors names to CREDITS.TXT 2020-10-07 13:22:55 -04:00
LICENSE.TXT
llvm.spec.in
LLVMBuild.txt
README.txt Test commit. 2020-03-14 18:08:26 -07:00
RELEASE_TESTERS.TXT

The LLVM Compiler Infrastructure
================================

This directory and its subdirectories contain source code for LLVM,
a toolkit for the construction of highly optimized compilers,
optimizers, and runtime environments.

LLVM is open source software. You may freely distribute it under the terms of
the license agreement found in LICENSE.txt.

Please see the documentation provided in docs/ for further
assistance with LLVM, and in particular docs/GettingStarted.rst for getting
started with LLVM and docs/README.txt for an overview of LLVM's
documentation setup.

If you are writing a package for LLVM, see docs/Packaging.rst for our
suggestions.