summaryrefslogtreecommitdiff
path: root/test/FrontendC/2009-01-05-BlockInlining.c
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-01-05 21:07:34 +0000
committerChris Lattner <sabre@nondot.org>2009-01-05 21:07:34 +0000
commitc6c22e25425b41b9b3f84682c5188ce585b1eab3 (patch)
tree5271e037ace3afcef58531a0f351bc4855a7d615 /test/FrontendC/2009-01-05-BlockInlining.c
parentde77ebcbb9e4554d41ff29608ad716f922e0db98 (diff)
downloadllvm-c6c22e25425b41b9b3f84682c5188ce585b1eab3.tar.gz
llvm-c6c22e25425b41b9b3f84682c5188ce585b1eab3.tar.bz2
llvm-c6c22e25425b41b9b3f84682c5188ce585b1eab3.tar.xz
testcase for bill's patch.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61751 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/FrontendC/2009-01-05-BlockInlining.c')
-rw-r--r--test/FrontendC/2009-01-05-BlockInlining.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/FrontendC/2009-01-05-BlockInlining.c b/test/FrontendC/2009-01-05-BlockInlining.c
new file mode 100644
index 0000000000..64e6c07a77
--- /dev/null
+++ b/test/FrontendC/2009-01-05-BlockInlining.c
@@ -0,0 +1,26 @@
+// RUN: %llvmgcc %s -S -emit-llvm -O2 -o - | grep {call i32 .*printf.*argc} | count 3
+// rdar://5865221
+
+// All of these should be inlined equivalently into a single printf call.
+
+static int fun(int x) {
+ return x+1;
+}
+
+static int block(int x) {
+ return (^(int x){return x+1;})(x);
+}
+
+static void print(int result) {
+ printf("%d\n", result);
+}
+
+int main (int argc, const char * argv[]) {
+ int x = argc-1;
+ print(fun(x));
+ print(block(x));
+ int (^block_inline)(int) = ^(int x){return x+1;};
+ print(block_inline(x));
+ return 0;
+}
+