[llvm-commits] CVS: llvm/test/Regression/Transforms/GlobalOpt/malloc-promote-1.llx malloc-promote-2.llx

Chris Lattner lattner at cs.uiuc.edu
Sun Oct 10 22:00:53 PDT 2004



Changes in directory llvm/test/Regression/Transforms/GlobalOpt:

malloc-promote-1.llx added (r1.1)
malloc-promote-2.llx added (r1.1)
---
Log message:

These testcases check to see if we can promote malloc's to globals in some
cases.


---
Diffs of the changes:  (+38 -0)

Index: llvm/test/Regression/Transforms/GlobalOpt/malloc-promote-1.llx
diff -c /dev/null llvm/test/Regression/Transforms/GlobalOpt/malloc-promote-1.llx:1.1
*** /dev/null	Mon Oct 11 00:00:53 2004
--- llvm/test/Regression/Transforms/GlobalOpt/malloc-promote-1.llx	Mon Oct 11 00:00:12 2004
***************
*** 0 ****
--- 1,18 ----
+ ; RUN: llvm-as < %s | opt -globalopt | llvm-dis | not grep global
+ 
+ %G = internal global int* null
+ 
+ void %init() {
+ 	%P = malloc int
+ 	store int* %P, int** %G
+ 
+ 	%GV = load int** %G
+ 	store int 0, int* %GV
+ 	ret void
+ }
+ 
+ int %get() {
+ 	%GV = load int** %G
+ 	%V = load int* %GV
+ 	ret int %V
+ }


Index: llvm/test/Regression/Transforms/GlobalOpt/malloc-promote-2.llx
diff -c /dev/null llvm/test/Regression/Transforms/GlobalOpt/malloc-promote-2.llx:1.1
*** /dev/null	Mon Oct 11 00:00:53 2004
--- llvm/test/Regression/Transforms/GlobalOpt/malloc-promote-2.llx	Mon Oct 11 00:00:12 2004
***************
*** 0 ****
--- 1,20 ----
+ ; RUN: llvm-as < %s | opt -globalopt | llvm-dis | not grep malloc
+ 
+ %G = internal global int* null
+ 
+ void %init() {
+ 	%P = malloc int, uint 100
+ 	store int* %P, int** %G
+ 
+ 	%GV = load int** %G
+ 	%GVe = getelementptr int* %GV, int 40
+ 	store int 20, int* %GVe
+ 	ret void
+ }
+ 
+ int %get() {
+ 	%GV = load int** %G
+ 	%GVe = getelementptr int* %GV, int 40
+ 	%V = load int* %GVe
+ 	ret int %V
+ }






More information about the llvm-commits mailing list