aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-profile.c
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2016-11-14 13:09:48 +0100
committerMartin Liska <marxin@gcc.gnu.org>2016-11-14 12:09:48 +0000
commit4d2098539a53d9e2dddd6233fb68820715d95862 (patch)
treeddc0a002eeabbf51f86b3f439e6a98477e64cc67 /gcc/tree-profile.c
parentf6b9a2a0c58a6f8b29f801fd1631c7eee5138c3a (diff)
downloadgcc-4d2098539a53d9e2dddd6233fb68820715d95862.zip
gcc-4d2098539a53d9e2dddd6233fb68820715d95862.tar.gz
gcc-4d2098539a53d9e2dddd6233fb68820715d95862.tar.bz2
Introduce -fprofile-update=prefer-atomic
PR bootstrap/78069 * common.opt: Add prefer-atomic as a new enum value for -fprofile-update. * coretypes.h: Likewise. * doc/invoke.texi: Document the new option value. * gcc.c: Replace atomic with prefer-atomic. Remove warning. * tree-profile.c (tree_profiling): Select default value of -fprofile-update when 'prefer-atomic' is selected. PR bootstrap/78069 * gcc.dg/no_profile_instrument_function-attr-1.c: Update test to match scanned pattern. * gcc.dg/tree-ssa/ssa-lim-11.c: Likewise. From-SVN: r242386
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 d18b954..a4f9d11 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(). */