diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2009-01-02 03:46:56 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2009-01-02 03:46:56 +0000 |
commit | 6b0568628319e08b36b8ec14793083e6bbf101a7 (patch) | |
tree | 4e600f6b3b7547f0ec7c9786d81dceef6612ed5b /test/Transforms/FunctionAttrs | |
parent | b9b3a702c46f5f22364d07f26f20ad8b9fe97f34 (diff) | |
download | llvm-6b0568628319e08b36b8ec14793083e6bbf101a7.tar.gz llvm-6b0568628319e08b36b8ec14793083e6bbf101a7.tar.bz2 llvm-6b0568628319e08b36b8ec14793083e6bbf101a7.tar.xz |
Make adding nocapture a bit stronger. FreeInst is nocapture. Also,
functions that don't write can't leak a pointer except through
the return value, so a void readonly function is implicitly nocapture.
Test these, and add a test that verifies that f1 calling f2 with an
otherwise dead pointer gets both of them marked nocapture.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61552 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/FunctionAttrs')
-rw-r--r-- | test/Transforms/FunctionAttrs/2008-12-31-NoCapture.ll | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/test/Transforms/FunctionAttrs/2008-12-31-NoCapture.ll b/test/Transforms/FunctionAttrs/2008-12-31-NoCapture.ll index 61c607dc00..758f0dd3ad 100644 --- a/test/Transforms/FunctionAttrs/2008-12-31-NoCapture.ll +++ b/test/Transforms/FunctionAttrs/2008-12-31-NoCapture.ll @@ -1,5 +1,5 @@ ; RUN: llvm-as < %s | opt -functionattrs | llvm-dis | not grep {nocapture *%%q} -; RUN: llvm-as < %s | opt -functionattrs | llvm-dis | grep {nocapture *%%p} | count 3 +; RUN: llvm-as < %s | opt -functionattrs | llvm-dis | grep {nocapture *%%p} | count 8 @g = global i32* null ; <i32**> [#uses=1] define i32* @c1(i32* %q) { @@ -62,3 +62,25 @@ define void @nc3(void ()* %p) { call void %p() ret void } + +declare void @external(i8*) readonly +define void @nc4(i8* %p) { + call void @external(i8* %p) + ret void +} + +define void @nc5(void (i8*)* %f, i8* %p) { + call void %f(i8* %p) readonly + call void %f(i8* nocapture %p) + ret void +} + +define void @nc6(i8* %p) { + call void @nc7(i8* %p) + ret void +} + +define void @nc7(i8* %p) { + call void @nc6(i8* %p) + ret void +} |