| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O2 -fpic -fdump-rtl-loop2_invariant" } */ |
| 3 |
/* { dg-require-effective-target fpic } */ |
| 4 |
/* { dg-skip-if "Load/Store hoisted by RTL PRE already" { aarch64*-*-* } { "-mcmodel=tiny" "-mcmodel=large" } { "" } } */ |
| 5 |
|
| 6 |
int bar (int); |
| 7 |
int cal (void *); |
| 8 |
|
| 9 |
int |
| 10 |
foo (int a, int bound) |
| 11 |
{ |
| 12 |
int i = 0; |
| 13 |
int sum = 0; |
| 14 |
|
| 15 |
for (i; i < bound; i++) |
| 16 |
sum = cal (bar); |
| 17 |
|
| 18 |
return sum; |
| 19 |
} |
| 20 |
|
| 21 |
/* The insn which loads function address from GOT table should be moved out |
| 22 |
of the loop. */ |
| 23 |
/* { dg-final { scan-rtl-dump "Decided" "loop2_invariant" } } */ |