diff options
| author | Reid Spencer <rspencer@reidspencer.com> | 2007-01-17 07:59:14 +0000 |
|---|---|---|
| committer | Reid Spencer <rspencer@reidspencer.com> | 2007-01-17 07:59:14 +0000 |
| commit | 83b3d8267225d585678d5d3af9bba5735f4b415d (patch) | |
| tree | 9d6c2ad7bfd568186e83a39e6f03e1c0bf415715 /llvm/test/Analysis/GlobalsModRef | |
| parent | 100602d7561ca5e245db6194bddae86357d203d4 (diff) | |
| download | bcm5719-llvm-83b3d8267225d585678d5d3af9bba5735f4b415d.tar.gz bcm5719-llvm-83b3d8267225d585678d5d3af9bba5735f4b415d.zip | |
Regression is gone, don't try to find it on clean target.
llvm-svn: 33296
Diffstat (limited to 'llvm/test/Analysis/GlobalsModRef')
| -rw-r--r-- | llvm/test/Analysis/GlobalsModRef/.cvsignore | 3 | ||||
| -rw-r--r-- | llvm/test/Analysis/GlobalsModRef/aliastest.ll | 9 | ||||
| -rw-r--r-- | llvm/test/Analysis/GlobalsModRef/chaining-analysis.ll | 20 | ||||
| -rw-r--r-- | llvm/test/Analysis/GlobalsModRef/dg.exp | 3 | ||||
| -rw-r--r-- | llvm/test/Analysis/GlobalsModRef/indirect-global.ll | 25 | ||||
| -rw-r--r-- | llvm/test/Analysis/GlobalsModRef/modreftest.ll | 13 | ||||
| -rw-r--r-- | llvm/test/Analysis/GlobalsModRef/purecse.ll | 23 |
7 files changed, 96 insertions, 0 deletions
diff --git a/llvm/test/Analysis/GlobalsModRef/.cvsignore b/llvm/test/Analysis/GlobalsModRef/.cvsignore new file mode 100644 index 00000000000..7f2443f2f31 --- /dev/null +++ b/llvm/test/Analysis/GlobalsModRef/.cvsignore @@ -0,0 +1,3 @@ +Output +*.log +*.sum diff --git a/llvm/test/Analysis/GlobalsModRef/aliastest.ll b/llvm/test/Analysis/GlobalsModRef/aliastest.ll new file mode 100644 index 00000000000..4363d3b30fd --- /dev/null +++ b/llvm/test/Analysis/GlobalsModRef/aliastest.ll @@ -0,0 +1,9 @@ +; RUN: llvm-upgrade < %s | llvm-as | opt -globalsmodref-aa -load-vn -gcse | llvm-dis | not grep load +%X = internal global int 4 + +int %test(int *%P) { + store int 7, int* %P + store int 12, int* %X ;; cannot alias P, X's addr isn't taken + %V = load int* %P + ret int %V +} diff --git a/llvm/test/Analysis/GlobalsModRef/chaining-analysis.ll b/llvm/test/Analysis/GlobalsModRef/chaining-analysis.ll new file mode 100644 index 00000000000..49244563c0c --- /dev/null +++ b/llvm/test/Analysis/GlobalsModRef/chaining-analysis.ll @@ -0,0 +1,20 @@ +; RUN: llvm-upgrade < %s | llvm-as | opt -globalsmodref-aa -load-vn -gcse | llvm-dis | not grep load + +; 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 + +declare double %sin(double) + +int %test(int *%P) { + store int 12, int* %X + call double %doesnotmodX(double 1.0) + %V = load int* %X + ret int %V +} + +double %doesnotmodX(double %V) { + %V2 = call double %sin(double %V) + ret double %V2 +} diff --git a/llvm/test/Analysis/GlobalsModRef/dg.exp b/llvm/test/Analysis/GlobalsModRef/dg.exp new file mode 100644 index 00000000000..142de8a6c8f --- /dev/null +++ b/llvm/test/Analysis/GlobalsModRef/dg.exp @@ -0,0 +1,3 @@ +load_lib llvm-dg.exp + +llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $srcdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext $llvmgcc_version diff --git a/llvm/test/Analysis/GlobalsModRef/indirect-global.ll b/llvm/test/Analysis/GlobalsModRef/indirect-global.ll new file mode 100644 index 00000000000..bb75732bebb --- /dev/null +++ b/llvm/test/Analysis/GlobalsModRef/indirect-global.ll @@ -0,0 +1,25 @@ +; RUN: llvm-upgrade < %s | llvm-as | \ +; RUN: opt -globalsmodref-aa -load-vn -gcse -instcombine | llvm-dis | \ +; RUN: grep 'ret i32 0' +%G = internal global int* null + +implementation + +void %test() { + %A = malloc int + store int* %A, int** %G + ret void +} + +int %test1(int *%P) { + %g1 = load int** %G + %h1 = load int* %g1 + + ; This store cannot alias either G or g1. + store int 123, int* %P + + %g2 = load int** %G + %h2 = load int* %g1 + %X = sub int %h1, %h2 ;; -> 0 + ret int %X +} diff --git a/llvm/test/Analysis/GlobalsModRef/modreftest.ll b/llvm/test/Analysis/GlobalsModRef/modreftest.ll new file mode 100644 index 00000000000..fadc7471f8d --- /dev/null +++ b/llvm/test/Analysis/GlobalsModRef/modreftest.ll @@ -0,0 +1,13 @@ +; RUN: llvm-upgrade < %s | llvm-as | opt -globalsmodref-aa -load-vn -gcse | llvm-dis | not grep load +%X = internal global int 4 + +int %test(int *%P) { + store int 12, int* %X + call void %doesnotmodX() + %V = load int* %X + ret int %V +} + +void %doesnotmodX() { + ret void +} diff --git a/llvm/test/Analysis/GlobalsModRef/purecse.ll b/llvm/test/Analysis/GlobalsModRef/purecse.ll new file mode 100644 index 00000000000..0c95182d46d --- /dev/null +++ b/llvm/test/Analysis/GlobalsModRef/purecse.ll @@ -0,0 +1,23 @@ +; Test that pure functions are cse'd away + +; RUN: llvm-upgrade < %s | llvm-as | opt -globalsmodref-aa -load-vn -gcse -instcombine | llvm-dis | not grep sub + +int %pure(int %X) { + %Y = add int %X, 1 + ret int %Y +} + +int %test1(int %X) { + %A = call int %pure(int %X) + %B = call int %pure(int %X) + %C = sub int %A, %B + ret int %C +} + +int %test2(int %X, int* %P) { + %A = call int %pure(int %X) + store int %X, int* %P ;; Does not invalidate 'pure' call. + %B = call int %pure(int %X) + %C = sub int %A, %B + ret int %C +} |

