aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/tls/thread_local-cse.C
blob: 5a47e988fc89b221f77122b973a81b5678fbee54 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// Test for CSE of the wrapper function: we should only call it once
// for the two references to ir.
// { dg-do run { target c++11 } }
// { dg-options "-O -fno-inline -save-temps" }
// { dg-add-options tls }
// { dg-require-effective-target tls_runtime }
// { dg-final { scan-assembler-times "call *_ZTW2ir" 1 { xfail *-*-* } } }
// { dg-final cleanup-saved-temps }

// XFAILed until the back end supports a way to mark a function as cseable
// though not pure.

int f() { return 42; }

thread_local int ir = f();

int main()
{
  return ir + ir - 84;
}