summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoachim Protze <protze@itc.rwth-aachen.de>2018-02-06 08:41:27 +0000
committerJoachim Protze <protze@itc.rwth-aachen.de>2018-02-06 08:41:27 +0000
commit2a20299f9158fb8403b9a11a1eb8f803cb4a562a (patch)
tree916be80d6dc63bc97b2b2353e51937c1d9db86a0
parent333be329c49bffa98741085a0ae0962e754cc7cf (diff)
downloadbcm5719-llvm-2a20299f9158fb8403b9a11a1eb8f803cb4a562a.tar.gz
bcm5719-llvm-2a20299f9158fb8403b9a11a1eb8f803cb4a562a.zip
[OMPT] Fix tool initialization returning 0
If tool initialization returns 0, OMPT should not be active. The current implementation provided some callback invocations in this case. Differential Revision: https://reviews.llvm.org/D42709 llvm-svn: 324320
-rw-r--r--openmp/runtime/src/ompt-general.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/openmp/runtime/src/ompt-general.cpp b/openmp/runtime/src/ompt-general.cpp
index 5bc72aa0aa7..46d5be5c3a5 100644
--- a/openmp/runtime/src/ompt-general.cpp
+++ b/openmp/runtime/src/ompt-general.cpp
@@ -332,6 +332,12 @@ void ompt_post_init() {
ompt_enabled.enabled = !!ompt_start_tool_result->initialize(
ompt_fn_lookup, &(ompt_start_tool_result->tool_data));
+ if (!ompt_enabled.enabled) {
+ // tool not enabled, zero out the bitmap, and done
+ memset(&ompt_enabled, 0, sizeof(ompt_enabled));
+ return;
+ }
+
ompt_thread_t *root_thread = ompt_get_thread();
ompt_set_thread_state(root_thread, omp_state_overhead);
OpenPOWER on IntegriCloud