diff options
| author | Duncan Sands <baldrick@free.fr> | 2007-11-22 21:43:27 +0000 |
|---|---|---|
| committer | Duncan Sands <baldrick@free.fr> | 2007-11-22 21:43:27 +0000 |
| commit | 497b40ee2926891aed8068da9a2f5f7f2ea36176 (patch) | |
| tree | 5fcaa80255be792695576f027280ce5d9ad1b2aa /test/Analysis | |
| parent | 05fde2e5e659bc2689f8363b344f5fe13f08680f (diff) | |
| download | external_llvm-497b40ee2926891aed8068da9a2f5f7f2ea36176.zip external_llvm-497b40ee2926891aed8068da9a2f5f7f2ea36176.tar.gz external_llvm-497b40ee2926891aed8068da9a2f5f7f2ea36176.tar.bz2 | |
Teach alias analysis about readnone/readonly functions.
Based on a patch by Török Edwin.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44279 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Analysis')
| -rw-r--r-- | test/Analysis/BasicAA/pure-const-dce.ll | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/test/Analysis/BasicAA/pure-const-dce.ll b/test/Analysis/BasicAA/pure-const-dce.ll new file mode 100644 index 0000000..6abc7da --- /dev/null +++ b/test/Analysis/BasicAA/pure-const-dce.ll @@ -0,0 +1,33 @@ +; RUN: llvm-as < %s | opt -basicaa -gvn | llvm-dis | grep TestConst | count 2 +; RUN: llvm-as < %s | opt -basicaa -gvn | llvm-dis | grep TestPure | not count 2 +; RUN: llvm-as < %s | opt -basicaa -gvn | llvm-dis | grep TestNone | count 4 +@g = global i32 0 ; <i32*> [#uses=1] + +define i32 @test() { +entry: + %tmp0 = call i32 @TestConst( i32 5 ) readnone ; <i32> [#uses=1] + %tmp1 = call i32 @TestPure( i32 6 ) readonly ; <i32> [#uses=1] + %tmp2 = call i32 @TestNone( i32 7 ) ; <i32> [#uses=1] + store i32 1, i32* @g + %tmp3 = call i32 @TestConst( i32 5 ) readnone ; <i32> [#uses=1] + %tmp4 = call i32 @TestConst( i32 5 ) readnone ; <i32> [#uses=1] + %tmp5 = call i32 @TestPure( i32 6 ) readonly ; <i32> [#uses=1] + %tmp6 = call i32 @TestPure( i32 6 ) readonly ; <i32> [#uses=1] + %tmp7 = call i32 @TestNone( i32 7 ) ; <i32> [#uses=1] + %tmp8 = call i32 @TestNone( i32 7 ) ; <i32> [#uses=1] + %sum0 = add i32 %tmp0, %tmp1 ; <i32> [#uses=1] + %sum1 = add i32 %sum0, %tmp2 ; <i32> [#uses=1] + %sum2 = add i32 %sum1, %tmp3 ; <i32> [#uses=1] + %sum3 = add i32 %sum2, %tmp4 ; <i32> [#uses=1] + %sum4 = add i32 %sum3, %tmp5 ; <i32> [#uses=1] + %sum5 = add i32 %sum4, %tmp6 ; <i32> [#uses=1] + %sum6 = add i32 %sum5, %tmp7 ; <i32> [#uses=1] + %sum7 = add i32 %sum6, %tmp8 ; <i32> [#uses=1] + ret i32 %sum7 +} + +declare i32 @TestConst(i32) readnone + +declare i32 @TestPure(i32) readonly + +declare i32 @TestNone(i32) |
