1 /* { dg-do compile } */ 2 /* { dg-options "-fgnu-tm -O3 -fdump-tree-tmmark" } */ 3 /* Like memopt-12.c but the phi is inside a look which causes 4 it to be converted into a COND_EXPR. */ 5 6 extern int test(void) __attribute__((transaction_safe)); 7 extern void *malloc (__SIZE_TYPE__) __attribute__((malloc,transaction_safe)); 8 9 struct large { int foo[500]; }; 10 f(int j)11int f(int j) 12 { 13 int *p1, *p2, *p3; 14 15 p1 = malloc (sizeof (*p1)*5000); 16 __transaction_atomic { 17 _Bool t; 18 int i = 1; 19 *p1 = 0; 20 21 p2 = malloc (sizeof (*p2)*6000); 22 *p2 = 1; 23 t = test(); 24 25 for (i = 0;i < j;i++) 26 { 27 28 /* p3 = PHI (p1, p2) */ 29 if (t) 30 p3 = p1; 31 else 32 p3 = p2; 33 34 /* Since both p1 and p2 are thread-private, we can inherit the 35 logging already done. No ITM_W* instrumentation necessary. */ 36 *p3 = 555; 37 } 38 } 39 return p3[something()]; 40 } 41 42 /* { dg-final { scan-tree-dump-times "ITM_WU" 0 "tmmark" } } */ 43 /* { dg-final { cleanup-tree-dump "tmmark" } } */ 44