diff options
author | Aldy Hernandez <aldyh@redhat.com> | 2012-01-24 13:38:10 +0000 |
---|---|---|
committer | Aldy Hernandez <aldyh@redhat.com> | 2012-01-24 13:38:10 +0000 |
commit | cd423ecec02d32d62a1a8191b26fe25ea8bc8478 (patch) | |
tree | 62ff220c08d544c8a6b59e2524b1fa34f424a684 /gcc/trans-mem.c | |
parent | 19f282fe27e0a8ae0639f243d8671d4bd7137178 (diff) |
+ * trans-mem.c (requires_barrier): Do not instrument thread local
+ variables and emit save/restore for them.
git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@183476 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/trans-mem.c')
-rw-r--r-- | gcc/trans-mem.c | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/gcc/trans-mem.c b/gcc/trans-mem.c index de7a913be66..06b1d8112bd 100644 --- a/gcc/trans-mem.c +++ b/gcc/trans-mem.c @@ -1,5 +1,5 @@ /* Passes for transactional memory support. - Copyright (C) 2008, 2009, 2010, 2011 Free Software Foundation, Inc. + Copyright (C) 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. This file is part of GCC. @@ -1488,7 +1488,18 @@ requires_barrier (basic_block entry_block, tree x, gimple stmt) } if (is_global_var (x)) - return !TREE_READONLY (x); + { + if (DECL_THREAD_LOCAL_P (x)) + goto thread_local; + if (DECL_HAS_VALUE_EXPR_P (x)) + { + tree value = get_base_address (DECL_VALUE_EXPR (x)); + + if (value && DECL_P (value) && DECL_THREAD_LOCAL_P (value)) + goto thread_local; + } + return !TREE_READONLY (x); + } if (/* FIXME: This condition should actually go below in the tm_log_add() call, however is_call_clobbered() depends on aliasing info which is not available during @@ -1498,17 +1509,14 @@ requires_barrier (basic_block entry_block, tree x, gimple stmt) lower_sequence_tm altogether. */ needs_to_live_in_memory (x)) return true; - else - { - /* For local memory that doesn't escape (aka thread private - memory), we can either save the value at the beginning of - the transaction and restore on restart, or call a tm - function to dynamically save and restore on restart - (ITM_L*). */ - if (stmt) - tm_log_add (entry_block, orig, stmt); - return false; - } + thread_local: + /* For local memory that doesn't escape (aka thread private memory), + we can either save the value at the beginning of the transaction and + restore on restart, or call a tm function to dynamically save and + restore on restart (ITM_L*). */ + if (stmt) + tm_log_add (entry_block, orig, stmt); + return false; default: return false; |