[llvm] LangRef: mention that willreturn can cause time-traveling UB (PR #214229)

Eli Friedman via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 14 10:05:35 PDT 2026


================
@@ -105,6 +106,9 @@ optimize the function to simply:
       unreachable
     }
 
+Without ``willreturn``, UB in LLVM will never exhibit time-traveling. This means
+frontends can avoid time-traveling UB by only putting ``willreturn`` on
+functions without observable behavior.
 
----------------
efriedma-quic wrote:

It's maybe worth clarifying that the lack of "time-travelling" only applies to things which are formally allowed to stop execution (volatile memory acccesses/IO/etc.)  LLVM can and will infer willreturn for functions that have contain atomics and other similar constructs.

https://github.com/llvm/llvm-project/pull/214229


More information about the llvm-commits mailing list