OSDN Git Service

testcase for bill's patch.
authorChris Lattner <sabre@nondot.org>
Mon, 5 Jan 2009 21:07:34 +0000 (21:07 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 5 Jan 2009 21:07:34 +0000 (21:07 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61751 91177308-0d34-0410-b5e6-96231b3b80d8

test/FrontendC/2009-01-05-BlockInlining.c [new file with mode: 0644]

diff --git a/test/FrontendC/2009-01-05-BlockInlining.c b/test/FrontendC/2009-01-05-BlockInlining.c
new file mode 100644 (file)
index 0000000..64e6c07
--- /dev/null
@@ -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;
+}
+