[PATCH] D62801: Add "willreturn" function attribute

Johannes Doerfert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 4 13:10:47 PDT 2019


jdoerfert added a comment.

Maybe also a test which in IR has multiple returns, and two that do not have any but only unreachable exits (one positive, one negative).
You probably have to build them by hand and not from C.



================
Comment at: llvm/test/Transforms/FunctionAttrs/will-return.ll:52
+; }
+; fact_maybe_not(-1) doesn't stop.
+
----------------
It actually will terminate, eventually:

`n = -1, -2, ... INT_MIN, INT_MAX, INT_MAX - 1, INT_MAX - 2, ... 0`

you maybe want `return fact_maybe_not_halt( n > 0 ? n-1 : n) * n;`


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

https://reviews.llvm.org/D62801





More information about the llvm-commits mailing list