Add tests for two types of traps that escape analysis

might one day fall into.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61549 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Duncan Sands 2009-01-02 00:55:51 +00:00
parent 88e76757de
commit 29ab02b2c2

View File

@ -16,6 +16,29 @@ define void @c3(i32* %q) {
ret void
}
define i1 @c4(i32* %q, i32 %bitno) {
%tmp = ptrtoint i32* %q to i32
%tmp2 = lshr i32 %tmp, %bitno
%bit = trunc i32 %tmp2 to i1
br i1 %bit, label %l1, label %l0
l0:
ret i1 0 ; escaping value not caught by def-use chaining.
l1:
ret i1 1 ; escaping value not caught by def-use chaining.
}
@lookup_table = global [2 x i1] [ i1 0, i1 1 ]
define i1 @c5(i32* %q, i32 %bitno) {
%tmp = ptrtoint i32* %q to i32
%tmp2 = lshr i32 %tmp, %bitno
%bit = and i32 %tmp2, 1
; subtle escape mechanism follows
%lookup = getelementptr [2 x i1]* @lookup_table, i32 0, i32 %bit
%val = load i1* %lookup
ret i1 %val
}
define i32 @nc1(i32* %q, i32* %p, i1 %b) {
e:
br label %l