aboutsummaryrefslogtreecommitdiff
path: root/openmp/runtime/src/kmp_affinity.cpp
diff options
context:
space:
mode:
authorJonathan Peyton <jonathan.l.peyton@intel.com>2024-03-11 10:28:12 -0500
committerGitHub <noreply@github.com>2024-03-11 10:28:12 -0500
commit9b1c496898cbefdce74eb1cf1a0911eb3230d65b (patch)
treed8de58efdc18861a187a7ab1ed3c4ae65655e9d0 /openmp/runtime/src/kmp_affinity.cpp
parentde4d7015d05ee3d140298207bb09c239884a71f7 (diff)
downloadllvm-9b1c496898cbefdce74eb1cf1a0911eb3230d65b.zip
llvm-9b1c496898cbefdce74eb1cf1a0911eb3230d65b.tar.gz
llvm-9b1c496898cbefdce74eb1cf1a0911eb3230d65b.tar.bz2
[OpenMP] Fixup while loops to avoid bad NULL check (#83302)
Diffstat (limited to 'openmp/runtime/src/kmp_affinity.cpp')
-rw-r--r--openmp/runtime/src/kmp_affinity.cpp11
1 files changed, 3 insertions, 8 deletions
diff --git a/openmp/runtime/src/kmp_affinity.cpp b/openmp/runtime/src/kmp_affinity.cpp
index ae0b645..b79b57e 100644
--- a/openmp/runtime/src/kmp_affinity.cpp
+++ b/openmp/runtime/src/kmp_affinity.cpp
@@ -1829,14 +1829,8 @@ static bool __kmp_affinity_create_hwloc_map(kmp_i18n_id_t *const msg_id) {
// Figure out the depth and types in the topology
depth = 0;
- pu = hwloc_get_pu_obj_by_os_index(tp, __kmp_affin_fullMask->begin());
- KMP_ASSERT(pu);
- obj = pu;
- types[depth] = KMP_HW_THREAD;
- hwloc_types[depth] = obj->type;
- depth++;
- while (obj != root && obj != NULL) {
- obj = obj->parent;
+ obj = hwloc_get_pu_obj_by_os_index(tp, __kmp_affin_fullMask->begin());
+ while (obj && obj != root) {
#if HWLOC_API_VERSION >= 0x00020000
if (obj->memory_arity) {
hwloc_obj_t memory;
@@ -1858,6 +1852,7 @@ static bool __kmp_affinity_create_hwloc_map(kmp_i18n_id_t *const msg_id) {
hwloc_types[depth] = obj->type;
depth++;
}
+ obj = obj->parent;
}
KMP_ASSERT(depth > 0);