[PATCH] D62801: Add "will-return" function attribute

Johannes Doerfert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 3 07:01:44 PDT 2019


jdoerfert added a comment.

Can we have a test with some conditionals and multiple exits?

We also need more loop tests:

- Constant trip count
- Trip count known to be bounded (as you have one)
- Trip count potentially unbounded (for (unsigned i = s; i != e; i++) {})
- See als `LoopDeletion.cpp` as it basically has to prove similar things we are interested in



================
Comment at: llvm/docs/LangRef.rst:1479
+    This produces undefined behavior at runtime if the function never comes back
+    to the call site.
 ``nounwind``
----------------
You should allow exceptions here, I think. That would make `will-return` and orthogonal to `nounwind` (aka. no-throw).

We can also think about removing the hypen, idk what is best.




================
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)
----------------
Add a FIXME: this function will eventually return, we could be able to detect that.


================
Comment at: llvm/test/Transforms/FunctionAttrs/will-return.ll:55
+; FNATTR: Function Attrs: noinline norecurse nounwind readnone uwtable
+; FNATTR-NOT: "will-return"
+; FNATTR-NEXT: define i32 @fact_loop(i32)
----------------
Same as above. FIXME missing.


================
Comment at: llvm/test/Transforms/FunctionAttrs/will-return.ll:102
+; TEST 5 (negative case)
+; call exit/abort (has noreturn attribute)
+; FNATTR: Function Attrs: noreturn
----------------
Can we also have a conditional exit call test.


================
Comment at: llvm/test/Transforms/FunctionAttrs/will-return.ll:189
+; invoke a function with "will-return"
+; FIXME: We need a more argue about exception and invoke instruction.
+
----------------
I think this should be `will-return` but I can be convinced `will-return` should be stronger. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62801





More information about the llvm-commits mailing list