aboutsummaryrefslogtreecommitdiffstats
path: root/test/Transforms/FunctionAttrs
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2009-01-02 00:55:51 +0000
committerDuncan Sands <baldrick@free.fr>2009-01-02 00:55:51 +0000
commit29ab02b2c2539e4372628fcc867892c4d0840fa4 (patch)
tree21b42bccb833452751dae82a3fec39a8724d1f9a /test/Transforms/FunctionAttrs
parent88e76757deb4872fc5d0db8592019fa73bfecfe7 (diff)
downloadexternal_llvm-29ab02b2c2539e4372628fcc867892c4d0840fa4.zip
external_llvm-29ab02b2c2539e4372628fcc867892c4d0840fa4.tar.gz
external_llvm-29ab02b2c2539e4372628fcc867892c4d0840fa4.tar.bz2
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
Diffstat (limited to 'test/Transforms/FunctionAttrs')
-rw-r--r--test/Transforms/FunctionAttrs/2008-12-31-NoCapture.ll23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/Transforms/FunctionAttrs/2008-12-31-NoCapture.ll b/test/Transforms/FunctionAttrs/2008-12-31-NoCapture.ll
index 86feb43..61c607d 100644
--- a/test/Transforms/FunctionAttrs/2008-12-31-NoCapture.ll
+++ b/test/Transforms/FunctionAttrs/2008-12-31-NoCapture.ll
@@ -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