diff options
author | Chris Lattner <sabre@nondot.org> | 2009-01-05 21:07:34 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-01-05 21:07:34 +0000 |
commit | c6c22e25425b41b9b3f84682c5188ce585b1eab3 (patch) | |
tree | 5271e037ace3afcef58531a0f351bc4855a7d615 /test/FrontendC | |
parent | de77ebcbb9e4554d41ff29608ad716f922e0db98 (diff) | |
download | external_llvm-c6c22e25425b41b9b3f84682c5188ce585b1eab3.zip external_llvm-c6c22e25425b41b9b3f84682c5188ce585b1eab3.tar.gz external_llvm-c6c22e25425b41b9b3f84682c5188ce585b1eab3.tar.bz2 |
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')
-rw-r--r-- | test/FrontendC/2009-01-05-BlockInlining.c | 26 |
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 0000000..64e6c07 --- /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; +} + |