Merged revisions 208012,208018-208019,208021,208023-208030,208033,208037,208040-20804...
[official-gcc.git] / main / gcc / testsuite / g++.dg / tls / thread_local-cse.C
blob5a47e988fc89b221f77122b973a81b5678fbee54
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 // { dg-final cleanup-saved-temps }
10 // XFAILed until the back end supports a way to mark a function as cseable
11 // though not pure.
13 int f() { return 42; }
15 thread_local int ir = f();
17 int main()
19   return ir + ir - 84;