From cca3b2c9f64899a6ef52e30d328c59f547cc02ed Mon Sep 17 00:00:00 2001 From: Duncan Sands Date: Fri, 2 Jan 2009 00:55:51 +0000 Subject: [PATCH] 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 --- .../FunctionAttrs/2008-12-31-NoCapture.ll | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/test/Transforms/FunctionAttrs/2008-12-31-NoCapture.ll b/test/Transforms/FunctionAttrs/2008-12-31-NoCapture.ll index 86feb4318c6..61c607dc007 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 -- 2.11.0