blob: 9692d8f688ab625dfe0e0c08a1e81288073dc784 [file] [log] [blame]
Bill Wendlinge6a1fe52009-01-05 21:27:59 +00001// RUN: %llvmgcc %s -S -emit-llvm -O2 -o %t.s
2// RUN: grep {call i32 .*printf.*argc} %t.s | count 3
3// RUN: not grep __block_holder_tmp %t.s
Chris Lattnerc6c22e22009-01-05 21:07:34 +00004// rdar://5865221
5
6// All of these should be inlined equivalently into a single printf call.
7
8static int fun(int x) {
9 return x+1;
10}
11
12static int block(int x) {
13 return (^(int x){return x+1;})(x);
14}
15
16static void print(int result) {
17 printf("%d\n", result);
18}
19
20int main (int argc, const char * argv[]) {
21 int x = argc-1;
22 print(fun(x));
23 print(block(x));
24 int (^block_inline)(int) = ^(int x){return x+1;};
25 print(block_inline(x));
26 return 0;
27}
28