[llvm-commits] CVS: llvm/test/Regression/Transforms/Inline/dynamic_alloca_test.ll

Chris Lattner lattner at cs.uiuc.edu
Fri Jan 13 11:35:17 PST 2006



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

dynamic_alloca_test.ll added (r1.1)
---
Log message:

New testcase that functions with dynamic allocas can be inlined, and are
inlined correctly.


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

 dynamic_alloca_test.ll |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+)


Index: llvm/test/Regression/Transforms/Inline/dynamic_alloca_test.ll
diff -c /dev/null llvm/test/Regression/Transforms/Inline/dynamic_alloca_test.ll:1.1
*** /dev/null	Fri Jan 13 13:35:15 2006
--- llvm/test/Regression/Transforms/Inline/dynamic_alloca_test.ll	Fri Jan 13 13:35:05 2006
***************
*** 0 ****
--- 1,28 ----
+ ; Test that functions with dynamic allocas get inlined in a case where
+ ; naively inlining it would result in a miscompilation.
+ 
+ ; RUN: llvm-as < %s | opt -inline &&
+ ; RUN: llvm-as < %s | opt -inline | llvm-dis | grep llvm.stacksave &&
+ ; RUN: llvm-as < %s | opt -inline | llvm-dis | not grep callee
+ 
+ declare void %ext(int*)
+ implementation
+ 
+ internal void %callee(uint %N) {
+ 	%P = alloca int, uint %N     ;; dynamic alloca
+ 	call void %ext(int* %P)
+ 	ret void
+ }
+ 
+ void %foo(uint %N) {
+ 	br label %Loop
+ Loop:
+ 	%count = phi uint [0, %0], [%next, %Loop]
+ 	%next = add uint %count, 1
+ 	call void %callee(uint %N)
+ 	%cond = seteq uint %count, 100000
+ 	br bool %cond, label %out, label %Loop
+ out:
+ 	ret void
+ }
+ 






More information about the llvm-commits mailing list