[PATCH] D65718: [LangRef] Document forward-progress requirement

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 4 09:05:43 PDT 2019


nikic created this revision.
nikic added reviewers: hfinkel, chandlerc, efriedma, reames, jdoerfert, Meinersbur.
Herald added subscribers: llvm-commits, jfb.
Herald added a project: LLVM.

Followup on a recent discussion on D59978 <https://reviews.llvm.org/D59978>: It seems that the current consensus is that LLVM has a forward-progress requirement and also intends to keep it in the future. `llvm.sideeffect` is not a temporary workaround, but the final solution. While this is pretty disappointing for non-C++ frontends, let's make sure this is at least documented in LangRef.

I haven't found a great place to put this, so I created a separate section


Repository:
  rL LLVM

https://reviews.llvm.org/D65718

Files:
  llvm/docs/LangRef.rst


Index: llvm/docs/LangRef.rst
===================================================================
--- llvm/docs/LangRef.rst
+++ llvm/docs/LangRef.rst
@@ -2489,6 +2489,19 @@
 ``fast``
    This flag implies all of the others.
 
+Forward-Progress Requirement
+----------------------------
+
+Every thread of execution is required to eventually cause a side-effect
+(including but not limited to accessing of inaccessible memory, volatile or
+atomic memory access, or other forms of thread synchronization). Failure to
+cause a side-effect in a finite amount of time results in undefined behavior.
+
+In particular, infinite loops and infinite recursion without side-effects
+result in undefined behavior. Language frontends that do not have a
+forward-progress requirement should insert a call to `@llvm.sideeffect` as part
+of every function definition and every loop.
+
 .. _uselistorder:
 
 Use-list Order Directives


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65718.213248.patch
Type: text/x-patch
Size: 916 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190804/e1f0b37b/attachment.bin>


More information about the llvm-commits mailing list