| 1 |
// Test for CSE of the wrapper function: we should only call it once |
| 2 |
// for the two references to ir. |
| 3 |
// { dg-do run { target c++11 } } |
| 4 |
// { dg-options "-O -fno-inline -save-temps" } |
| 5 |
// { dg-add-options tls } |
| 6 |
// { dg-require-effective-target tls_runtime } |
| 7 |
// { dg-final { scan-assembler-times "call *_ZTW2ir" 1 { xfail *-*-* } } } |
| 8 |
|
| 9 |
// XFAILed until the back end supports a way to mark a function as cseable |
| 10 |
// though not pure. |
| 11 |
|
| 12 |
int f() { return 42; } |
| 13 |
|
| 14 |
thread_local int ir = f(); |
| 15 |
|
| 16 |
int main() |
| 17 |
{ |
| 18 |
return ir + ir - 84; |
| 19 |
} |