summaryrefslogtreecommitdiff
path: root/test/Transforms/FunctionAttrs
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2009-05-07 18:08:34 +0000
committerDuncan Sands <baldrick@free.fr>2009-05-07 18:08:34 +0000
commit1978426a94e3d3b53f488ffc56516e6e87906a0b (patch)
tree18271590fa0bba6ad40e9fa97efa3c791326bf90 /test/Transforms/FunctionAttrs
parent5b8479c38532a28d86dea8ded09a30ff68f26912 (diff)
downloadllvm-1978426a94e3d3b53f488ffc56516e6e87906a0b.tar.gz
llvm-1978426a94e3d3b53f488ffc56516e6e87906a0b.tar.bz2
llvm-1978426a94e3d3b53f488ffc56516e6e87906a0b.tar.xz
Revert r70876 and add a testcase (@c7) showing the problem:
bits captured, but the pointer marked nocapture. In fact I now recall that this problem is why only readnone functions returning void were considered before! However keep a small fix that was also in r70876: a readnone function returning void can result in bits being captured if it unwinds, so test for this. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71168 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/FunctionAttrs')
-rw-r--r--test/Transforms/FunctionAttrs/2008-12-31-NoCapture.ll27
1 files changed, 18 insertions, 9 deletions
diff --git a/test/Transforms/FunctionAttrs/2008-12-31-NoCapture.ll b/test/Transforms/FunctionAttrs/2008-12-31-NoCapture.ll
index aec134a8c7..39a64e6d36 100644
--- a/test/Transforms/FunctionAttrs/2008-12-31-NoCapture.ll
+++ b/test/Transforms/FunctionAttrs/2008-12-31-NoCapture.ll
@@ -49,6 +49,21 @@ ret1:
ret i1 1
}
+define i1* @lookup_bit(i32* %q, i32 %bitno) readnone nounwind {
+ %tmp = ptrtoint i32* %q to i32
+ %tmp2 = lshr i32 %tmp, %bitno
+ %bit = and i32 %tmp2, 1
+ %lookup = getelementptr [2 x i1]* @lookup_table, i32 0, i32 %bit
+ ret i1* %lookup
+}
+
+define i1 @c7(i32* %q, i32 %bitno) {
+ %ptr = call i1* @lookup_bit(i32* %q, i32 %bitno)
+ %val = load i1* %ptr
+ ret i1 %val
+}
+
+
define i32 @nc1(i32* %q, i32* %p, i1 %b) {
e:
br label %l
@@ -79,14 +94,8 @@ define void @nc4(i8* %p) {
ret void
}
-define void @nc5(void (i8*)* %p, i8* %r) {
- call void %p(i8* %r)
- call void %p(i8* nocapture %r)
- ret void
-}
-
-declare i8* @external_identity(i8*) readonly nounwind
-define void @nc6(i8* %p) {
- call i8* @external_identity(i8* %p)
+define void @nc5(void (i8*)* %f, i8* %p) {
+ call void %f(i8* %p) readonly nounwind
+ call void %f(i8* nocapture %p)
ret void
}