| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O2 -fdump-ipa-sra" } */ |
| 3 |
|
| 4 |
/* Test that parameters can be removed even when they are returned but the |
| 5 |
return is unused. */ |
| 6 |
|
| 7 |
extern int use(int use); |
| 8 |
|
| 9 |
|
| 10 |
static int __attribute__((noinline)) |
| 11 |
foo(int a, int b, int c) |
| 12 |
{ |
| 13 |
use (c); |
| 14 |
return a + b + c; |
| 15 |
} |
| 16 |
|
| 17 |
static int __attribute__((noinline)) |
| 18 |
bar (int a, int b, int c, int d) |
| 19 |
{ |
| 20 |
return foo (a, b, c + d); |
| 21 |
} |
| 22 |
|
| 23 |
int |
| 24 |
baz (int a, int b, int c, int d) |
| 25 |
{ |
| 26 |
bar (a, b, c, d); |
| 27 |
return a + d; |
| 28 |
} |
| 29 |
|
| 30 |
/* { dg-final { scan-ipa-dump-times "Will remove parameter" 4 "sra" } } */ |