| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-fstrub=strict -fdump-ipa-strubm" } */ |
| 3 |
/* { dg-require-effective-target strub } */ |
| 4 |
|
| 5 |
static int __attribute__ ((__strub__)) var; |
| 6 |
|
| 7 |
/* h becomes STRUB_INLINABLE, because of the use of the strub variable, |
| 8 |
and the always_inline flag. It would get inlined before pass_ipa_strub, if |
| 9 |
it weren't for the error. */ |
| 10 |
static inline void |
| 11 |
__attribute__ ((__always_inline__)) |
| 12 |
h() { |
| 13 |
var++; |
| 14 |
} |
| 15 |
|
| 16 |
/* g becomes STRUB_AT_CALLS_OPT, because of the use of the strub variable, and |
| 17 |
the viability of at-calls strubbing. Though internally a strub context, its |
| 18 |
interface is not strub-enabled, so it's not callable from within strub |
| 19 |
contexts. */ |
| 20 |
static inline void |
| 21 |
g() { |
| 22 |
var--; |
| 23 |
h(); |
| 24 |
} |
| 25 |
|
| 26 |
/* f becomes STRUB_INTERNAL because of the use of the strub variable, and gets |
| 27 |
split into STRUB_WRAPPER and STRUB_WRAPPED. */ |
| 28 |
void |
| 29 |
f() { |
| 30 |
var++; |
| 31 |
g(); /* { dg-error "calling non-.strub." } */ |
| 32 |
} |
| 33 |
|
| 34 |
/* { dg-final { scan-ipa-dump-times "strub \[(\]" 3 "strubm" } } */ |
| 35 |
/* { dg-final { scan-ipa-dump-times "strub \[(\]inlinable\[)\]" 1 "strubm" } } */ |
| 36 |
/* { dg-final { scan-ipa-dump-times "strub \[(\]at-calls-opt\[)\]" 1 "strubm" } } */ |
| 37 |
/* { dg-final { scan-ipa-dump-times "strub \[(\]internal\[)\]" 1 "strubm" } } */ |