diff options
author | Johannes Doerfert <jdoerfert@anl.gov> | 2019-08-05 23:22:05 +0000 |
---|---|---|
committer | Johannes Doerfert <jdoerfert@anl.gov> | 2019-08-05 23:22:05 +0000 |
commit | e83f303938a5aa2f43ba1dbe024b16fec06f20cc (patch) | |
tree | e29d54da9aa01be3edf1b9eebd4c2df5d8562369 /llvm/test/Transforms/FunctionAttrs/nonnull.ll | |
parent | a5c25c5d469f0f9999610bb391bd156eb70e7975 (diff) | |
download | bcm5719-llvm-e83f303938a5aa2f43ba1dbe024b16fec06f20cc.tar.gz bcm5719-llvm-e83f303938a5aa2f43ba1dbe024b16fec06f20cc.zip |
[Attributor] Deduce the "no-return" attribute for functions
A function is "no-return" if we never reach a return instruction, either
because there are none or the ones that exist are dead.
Test have been adjusted:
- either noreturn was added, or
- noreturn was avoided by modifying the code.
The new noreturn_{sync,async} test make sure we do handle invoke
instructions with a noreturn (and potentially nowunwind) callee
correctly, even in the presence of potential asynchronous exceptions.
llvm-svn: 367948
Diffstat (limited to 'llvm/test/Transforms/FunctionAttrs/nonnull.ll')
-rw-r--r-- | llvm/test/Transforms/FunctionAttrs/nonnull.ll | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/llvm/test/Transforms/FunctionAttrs/nonnull.ll b/llvm/test/Transforms/FunctionAttrs/nonnull.ll index a236aeab8ac..466276a062d 100644 --- a/llvm/test/Transforms/FunctionAttrs/nonnull.ll +++ b/llvm/test/Transforms/FunctionAttrs/nonnull.ll @@ -21,16 +21,20 @@ define i8* @test2(i8* nonnull %p) { ; Given an SCC where one of the functions can not be marked nonnull, ; can we still mark the other one which is trivially nonnull -define i8* @scc_binder() { +define i8* @scc_binder(i1 %c) { ; FNATTR: define i8* @scc_binder ; ATTRIBUTOR: define noalias i8* @scc_binder - call i8* @test3() + br i1 %c, label %rec, label %end +rec: + call i8* @test3(i1 %c) + br label %end +end: ret i8* null } -define i8* @test3() { +define i8* @test3(i1 %c) { ; BOTH: define nonnull i8* @test3 - call i8* @scc_binder() + call i8* @scc_binder(i1 %c) %ret = call i8* @ret_nonnull() ret i8* %ret } @@ -54,17 +58,21 @@ define i8* @test4() { ; Given a mutual recursive set of functions which *can* return null ; make sure we haven't marked them as nonnull. -define i8* @test5_helper() { +define i8* @test5_helper(i1 %c) { ; FNATTR: define noalias i8* @test5_helper ; ATTRIBUTOR: define noalias i8* @test5_helper - %ret = call i8* @test5() + br i1 %c, label %rec, label %end +rec: + %ret = call i8* @test5(i1 %c) + br label %end +end: ret i8* null } -define i8* @test5() { +define i8* @test5(i1 %c) { ; FNATTR: define noalias i8* @test5 ; ATTRIBUTOR: define noalias i8* @test5 - %ret = call i8* @test5_helper() + %ret = call i8* @test5_helper(i1 %c) ret i8* %ret } |