| 1 |
// { dg-do compile } |
| 2 |
// { dg-options "-fgnu-tm -O2 -fno-inline -fdump-tree-tmedge" } |
| 3 |
|
| 4 |
class RBTree |
| 5 |
{ |
| 6 |
struct RBNode |
| 7 |
{ |
| 8 |
RBNode* next; |
| 9 |
}; |
| 10 |
|
| 11 |
public: |
| 12 |
RBNode* sentinel; |
| 13 |
__attribute__((transaction_safe)) bool lookup(); |
| 14 |
}; |
| 15 |
|
| 16 |
bool RBTree::lookup() |
| 17 |
{ |
| 18 |
RBNode* x = sentinel; |
| 19 |
while (x) |
| 20 |
x = x->next; |
| 21 |
return false; |
| 22 |
} |
| 23 |
|
| 24 |
|
| 25 |
RBTree* SET; |
| 26 |
|
| 27 |
void bench_test() |
| 28 |
{ |
| 29 |
__transaction_atomic { |
| 30 |
SET->lookup(); |
| 31 |
} |
| 32 |
} |
| 33 |
|
| 34 |
// There should be two calls to commitTransaction. |
| 35 |
// The one in the uninstrumented code path is a tail call. |
| 36 |
// The one in the instrumented code path is not. |
| 37 |
// { dg-final { scan-tree-dump-times "ITM_commitTransaction.*tail call" 1 "tmedge" } } |
| 38 |
|