2013-10-17 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / tm / memopt-4.c
blob58f8fd042d63b454298d10694c70f6b4cea75ad0
1 /* { dg-do compile } */
2 /* { dg-options "-fgnu-tm -O -fdump-tree-tmedge" } */
4 /* Test thread-local memory optimizations: save/restore pairs. */
6 struct large { int x[100]; };
7 struct large bark();
8 extern int test (void) __attribute__((transaction_safe));
10 int f()
12 int i = readint();
13 struct large lala = bark();
14 __transaction_atomic {
15 lala.x[55] = 666;
16 if (test())
17 __transaction_cancel;
19 return lala.x[i];
22 /* { dg-final { scan-tree-dump-times "tm_save.\[0-9_\]+ = lala.x\\\[55\\\]" 1 "tmedge" } } */
23 /* { dg-final { scan-tree-dump-times "lala.x\\\[55\\\] = tm_save" 1 "tmedge" } } */
24 /* { dg-final { cleanup-tree-dump "tmedge" } } */