summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-01-13 19:35:05 +0000
committerChris Lattner <sabre@nondot.org>2006-01-13 19:35:05 +0000
commitaccc5bfe928f2d7eebab032b071a33a1fd6f8bb7 (patch)
tree850acb1f24459fcfbb0ce33b60f5ccd07576e8eb
parent2be0607a8d18b61964c770e0e708104a6bfe7f16 (diff)
downloadbcm5719-llvm-accc5bfe928f2d7eebab032b071a33a1fd6f8bb7.tar.gz
bcm5719-llvm-accc5bfe928f2d7eebab032b071a33a1fd6f8bb7.zip
New testcase that functions with dynamic allocas can be inlined, and are
inlined correctly. llvm-svn: 25287
-rw-r--r--llvm/test/Regression/Transforms/Inline/dynamic_alloca_test.ll28
1 files changed, 28 insertions, 0 deletions
diff --git a/llvm/test/Regression/Transforms/Inline/dynamic_alloca_test.ll b/llvm/test/Regression/Transforms/Inline/dynamic_alloca_test.ll
new file mode 100644
index 00000000000..27c7d717a11
--- /dev/null
+++ b/llvm/test/Regression/Transforms/Inline/dynamic_alloca_test.ll
@@ -0,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
+}
+
OpenPOWER on IntegriCloud