view gcc/testsuite/g++.dg/tls/thread_local-cse.C @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
line wrap: on
line source

// 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 *-*-* } } }

// 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;
}