Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame^] | 1 | // RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm-bc -o - %s | opt --std-compile-opts | llvm-dis > %t |
Daniel Dunbar | 4fcfde4 | 2009-11-08 01:45:36 +0000 | [diff] [blame] | 2 | // RUN: grep "ret i32" %t | count 2 |
Daniel Dunbar | f9eede1 | 2008-07-30 21:00:24 +0000 | [diff] [blame] | 3 | // RUN: grep "ret i32 0" %t | count 2 |
| 4 | // <rdar://problem/6113085> |
| 5 | |
| 6 | struct s0 { |
| 7 | int x, y; |
| 8 | }; |
| 9 | |
| 10 | int f0() { |
| 11 | struct s0 x = {0}; |
| 12 | return x.y; |
| 13 | } |
| 14 | |
| 15 | #if 0 |
| 16 | /* Optimizer isn't smart enough to reduce this since we use |
| 17 | memset. Hrm. */ |
| 18 | int f1() { |
| 19 | struct s0 x[2] = { {0} }; |
| 20 | return x[1].x; |
| 21 | } |
| 22 | #endif |
| 23 | |
| 24 | int f2() { |
| 25 | int x[2] = { 0 }; |
| 26 | return x[1]; |
| 27 | } |
| 28 | |