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 | e4dc717585d5b891d187248352cbbc8d2438da96 (patch) | |
tree | d4334227cc13a82e2ae1f1cb6a4b834f96b0c3f6 /test/Analysis | |
parent | bb65098d2c8c08e1c45d5567c07f492e2a770aff (diff) | |
download | external_llvm-e4dc717585d5b891d187248352cbbc8d2438da96.zip external_llvm-e4dc717585d5b891d187248352cbbc8d2438da96.tar.gz external_llvm-e4dc717585d5b891d187248352cbbc8d2438da96.tar.bz2 |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44288 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Analysis')
-rw-r--r-- | test/Analysis/GlobalsModRef/chaining-analysis.ll | 24 | ||||
-rw-r--r-- | test/Analysis/LoadVN/call_cse.ll | 19 | ||||
-rw-r--r-- | test/Analysis/LoadVN/call_pure_function.ll | 21 |
3 files changed, 33 insertions, 31 deletions
diff --git a/test/Analysis/GlobalsModRef/chaining-analysis.ll b/test/Analysis/GlobalsModRef/chaining-analysis.ll index 4924456..e521cc1 100644 --- a/test/Analysis/GlobalsModRef/chaining-analysis.ll +++ b/test/Analysis/GlobalsModRef/chaining-analysis.ll @@ -1,20 +1,20 @@ -; RUN: llvm-upgrade < %s | llvm-as | opt -globalsmodref-aa -load-vn -gcse | llvm-dis | not grep load +; RUN: llvm-as < %s | opt -globalsmodref-aa -load-vn -gcse | llvm-dis | not grep load -; This test requires the use of previous analyses to determine that +; This test requires the use of previous analyses to determine that ; doesnotmodX does not modify X (because 'sin' doesn't). -%X = internal global int 4 +@X = internal global i32 4 ; <i32*> [#uses=2] -declare double %sin(double) +declare double @sin(double) readnone -int %test(int *%P) { - store int 12, int* %X - call double %doesnotmodX(double 1.0) - %V = load int* %X - ret int %V +define i32 @test(i32* %P) { + store i32 12, i32* @X + call double @doesnotmodX( double 1.000000e+00 ) ; <double>:1 [#uses=0] + %V = load i32* @X ; <i32> [#uses=1] + ret i32 %V } -double %doesnotmodX(double %V) { - %V2 = call double %sin(double %V) - ret double %V2 +define double @doesnotmodX(double %V) { + %V2 = call double @sin( double %V ) readnone ; <double> [#uses=1] + ret double %V2 } diff --git a/test/Analysis/LoadVN/call_cse.ll b/test/Analysis/LoadVN/call_cse.ll index 78cdd43..b62300f 100644 --- a/test/Analysis/LoadVN/call_cse.ll +++ b/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/test/Analysis/LoadVN/call_pure_function.ll b/test/Analysis/LoadVN/call_pure_function.ll index 302ae60..8055c52 100644 --- a/test/Analysis/LoadVN/call_pure_function.ll +++ b/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 } |