[PATCH] D62801: Add "willreturn" function attribute

Johannes Doerfert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 4 11:28:32 PDT 2019


jdoerfert added inline comments.


================
Comment at: llvm/docs/LangRef.rst:1479
+    at a point in the existing call stack that includes the current invocation.
+    This attribute doesn't mean that the function never throw an exception.
+    This produces undefined behavior at runtime if the function never comes back
----------------
> This attribute doesn't mean that the function never throw an exception.
Annotated functions may still raise an exception, i.a., ``nounwind`` is not implied.


================
Comment at: llvm/docs/LangRef.rst:1481
+    This produces undefined behavior at runtime if the function never comes back
+    to the call site.
 ``nounwind``
----------------
If an invocation of an annotated function does not return the control back to a point in the call stack, the behavior is undefined.


================
Comment at: llvm/test/Transforms/FunctionAttrs/will-return.ll:25
+; FNATTR: Function Attrs: noinline nounwind readnone uwtable
+; FNATTR-NOT: "will-return"
+; FNATTR-NEXT: define i32 @fib(i32)
----------------
uenoku wrote:
> jdoerfert wrote:
> > Add a FIXME: this function will eventually return, we could be able to detect that.
> I don't know the way for detecting this. Is there any tool to prove termination for LLVM IR function?
You are building it ;)


================
Comment at: llvm/test/Transforms/FunctionAttrs/will-return.ll:311
+;     int ans = 0;
+;     for(unsigned i = s;i != e;i++){
+;         ans += p[i];
----------------
I made a mistake here, it should be i+=2 or i+=stride (a new parameter)


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D62801/new/

https://reviews.llvm.org/D62801





More information about the llvm-commits mailing list