[llvm] 600cae7 - [LangRef] Try to clarify mustprogress wording. (#90510)

via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 30 10:16:16 PDT 2024


Author: Eli Friedman
Date: 2024-04-30T10:16:12-07:00
New Revision: 600cae7d421e6e280c6513510bb11b4dc7b16b48

URL: https://github.com/llvm/llvm-project/commit/600cae7d421e6e280c6513510bb11b4dc7b16b48
DIFF: https://github.com/llvm/llvm-project/commit/600cae7d421e6e280c6513510bb11b4dc7b16b48.diff

LOG: [LangRef] Try to clarify mustprogress wording. (#90510)

Ensure it's clear that:

- Infinite loops in non-mustprogress functions are well-defined, even if
they're called by mustprogress functions.
- Infinite recursion in mustprogress functions is not well-defined.

Looking at D86233, it's clear this was the intent, but the "transitive"
wording is ambiguous. Instead, just explicitly state that infinite loops
written in non-mustprogress functions count as progress.

Added: 
    

Modified: 
    llvm/docs/LangRef.rst

Removed: 
    


################################################################################
diff  --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index f79c1fd9278de3..8460a4695aff71 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -2447,12 +2447,14 @@ example:
     memory access, I/O, or other synchronization.  The ``mustprogress``
     attribute is intended to model the requirements of the first section of
     [intro.progress] of the C++ Standard. As a consequence, a loop in a
-    function with the `mustprogress` attribute can be assumed to terminate if
+    function with the ``mustprogress`` attribute can be assumed to terminate if
     it does not interact with the environment in an observable way, and
-    terminating loops without side-effects can be removed. If a `mustprogress`
-    function does not satisfy this contract, the behavior is undefined.  This
-    attribute does not apply transitively to callees, but does apply to call
-    sites within the function. Note that `willreturn` implies `mustprogress`.
+    terminating loops without side-effects can be removed. If a ``mustprogress``
+    function does not satisfy this contract, the behavior is undefined. If a
+    ``mustprogress`` function calls a function not marked ``mustprogress``,
+    and that function never returns, the program is well-defined even if there
+    isn't any other observable progress.  Note that ``willreturn`` implies
+    ``mustprogress``.
 ``"warn-stack-size"="<threshold>"``
     This attribute sets a threshold to emit diagnostics once the frame size is
     known should the frame size exceed the specified value.  It takes one


        


More information about the llvm-commits mailing list