summaryrefslogtreecommitdiff
path: root/gcc/tree-profile.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2016-11-14 15:42:40 +0100
committerRichard Guenther <rguenther@suse.de>2016-11-14 15:42:40 +0100
commitca94f8c64654980144e88fb19b04adf5f023aa55 (patch)
treeef90f8461d210f78e7f7b0ba89923a5eda7b3758 /gcc/tree-profile.c
parent9e872f3fe8b4f6624e2edf5ee55a833e53f290c8 (diff)
parent5dc46e164993bbf658f61069823a1b37a2d715eb (diff)
downloadgcc-gimplefe.tar.gz
Merge remote-tracking branch 'trunk' of git://gcc.gnu.org/git/gcc into gimplefegimplefe
Diffstat (limited to 'gcc/tree-profile.c')
-rw-r--r--gcc/tree-profile.c35
1 files changed, 18 insertions, 17 deletions
diff --git a/gcc/tree-profile.c b/gcc/tree-profile.c
index d18b954a385..a4f9d11b161 100644
--- a/gcc/tree-profile.c
+++ b/gcc/tree-profile.c
@@ -592,25 +592,26 @@ tree_profiling (void)
struct cgraph_node *node;
/* Verify whether we can utilize atomic update operations. */
- if (flag_profile_update == PROFILE_UPDATE_ATOMIC)
+ bool can_support_atomic = false;
+ unsigned HOST_WIDE_INT gcov_type_size
+ = tree_to_uhwi (TYPE_SIZE_UNIT (get_gcov_type ()));
+ if (gcov_type_size == 4)
+ can_support_atomic
+ = HAVE_sync_compare_and_swapsi || HAVE_atomic_compare_and_swapsi;
+ else if (gcov_type_size == 8)
+ can_support_atomic
+ = HAVE_sync_compare_and_swapdi || HAVE_atomic_compare_and_swapdi;
+
+ if (flag_profile_update == PROFILE_UPDATE_ATOMIC
+ && !can_support_atomic)
{
- bool can_support = false;
- unsigned HOST_WIDE_INT gcov_type_size
- = tree_to_uhwi (TYPE_SIZE_UNIT (get_gcov_type ()));
- if (gcov_type_size == 4)
- can_support
- = HAVE_sync_compare_and_swapsi || HAVE_atomic_compare_and_swapsi;
- else if (gcov_type_size == 8)
- can_support
- = HAVE_sync_compare_and_swapdi || HAVE_atomic_compare_and_swapdi;
-
- if (!can_support)
- {
- warning (0, "target does not support atomic profile update, "
- "single mode is selected");
- flag_profile_update = PROFILE_UPDATE_SINGLE;
- }
+ warning (0, "target does not support atomic profile update, "
+ "single mode is selected");
+ flag_profile_update = PROFILE_UPDATE_SINGLE;
}
+ else if (flag_profile_update == PROFILE_UPDATE_PREFER_ATOMIC)
+ flag_profile_update = can_support_atomic
+ ? PROFILE_UPDATE_ATOMIC : PROFILE_UPDATE_SINGLE;
/* This is a small-ipa pass that gets called only once, from
cgraphunit.c:ipa_passes(). */