diff options
| author | Duncan Sands <baldrick@free.fr> | 2007-11-23 19:30:27 +0000 |
|---|---|---|
| committer | Duncan Sands <baldrick@free.fr> | 2007-11-23 19:30:27 +0000 |
| commit | 8a3e9d2bee4a76732da1afe64026b9a9c7890cd0 (patch) | |
| tree | b1066b4d0db3ff71c45d57a0ee0e552e77ad1bfc /llvm/test/Analysis/LoadVN | |
| parent | b23192f48354af0d069c343e4725ab24a2671ec0 (diff) | |
| download | bcm5719-llvm-8a3e9d2bee4a76732da1afe64026b9a9c7890cd0.tar.gz bcm5719-llvm-8a3e9d2bee4a76732da1afe64026b9a9c7890cd0.zip | |
Ding dong, the DoesntAccessMemoryFns and
OnlyReadsMemoryFns tables are dead! We
get more, and more accurate, information
from gcc via the readnone and readonly
function attributes.
llvm-svn: 44288
Diffstat (limited to 'llvm/test/Analysis/LoadVN')
| -rw-r--r-- | llvm/test/Analysis/LoadVN/call_cse.ll | 19 | ||||
| -rw-r--r-- | llvm/test/Analysis/LoadVN/call_pure_function.ll | 21 |
2 files changed, 21 insertions, 19 deletions
diff --git a/llvm/test/Analysis/LoadVN/call_cse.ll b/llvm/test/Analysis/LoadVN/call_cse.ll index 78cdd43051f..b62300f5ab3 100644 --- a/llvm/test/Analysis/LoadVN/call_cse.ll +++ b/llvm/test/Analysis/LoadVN/call_cse.ll @@ -1,11 +1,12 @@ -; RUN: llvm-upgrade < %s | llvm-as | opt -basicaa -load-vn -gcse -instcombine | llvm-dis | not grep sub -declare int %strlen(sbyte*) +; RUN: llvm-as < %s | opt -basicaa -load-vn -gcse -instcombine | llvm-dis | not grep sub -int %test(sbyte* %P) { - %X = call int %strlen(sbyte* %P) - %A = add int %X, 14 - %Y = call int %strlen(sbyte* %P) - %Z = sub int %X, %Y - %B = add int %A, %Z - ret int %B +declare i32 @strlen(i8*) readonly + +define i32 @test(i8* %P) { + %X = call i32 @strlen( i8* %P ) readonly ; <i32> [#uses=2] + %A = add i32 %X, 14 ; <i32> [#uses=1] + %Y = call i32 @strlen( i8* %P ) readonly ; <i32> [#uses=1] + %Z = sub i32 %X, %Y ; <i32> [#uses=1] + %B = add i32 %A, %Z ; <i32> [#uses=1] + ret i32 %B } diff --git a/llvm/test/Analysis/LoadVN/call_pure_function.ll b/llvm/test/Analysis/LoadVN/call_pure_function.ll index 302ae604663..8055c5271f4 100644 --- a/llvm/test/Analysis/LoadVN/call_pure_function.ll +++ b/llvm/test/Analysis/LoadVN/call_pure_function.ll @@ -1,13 +1,14 @@ -; RUN: llvm-upgrade < %s | llvm-as | opt -basicaa -load-vn -gcse -instcombine | llvm-dis | not grep sub -declare int %strlen(sbyte*) -declare void %use(int %X) +; RUN: llvm-as < %s | opt -basicaa -load-vn -gcse -instcombine | llvm-dis | not grep sub -sbyte %test(sbyte* %P, sbyte* %Q) { - %A = load sbyte* %Q - %X = call int %strlen(sbyte* %P) - %B = load sbyte* %Q ;; CSE with A. - call void %use(int %X) ;; make strlen not dead +declare i32 @strlen(i8*) readonly - %C = sub sbyte %A, %B - ret sbyte %C +declare void @use(i32) + +define i8 @test(i8* %P, i8* %Q) { + %A = load i8* %Q ; <i8> [#uses=1] + %X = call i32 @strlen( i8* %P ) readonly ; <i32> [#uses=1] + %B = load i8* %Q ; <i8> [#uses=1] + call void @use( i32 %X ) + %C = sub i8 %A, %B ; <i8> [#uses=1] + ret i8 %C } |

