From dfbb3ce5f134ac49d0d447821d014ac37359bc07 Mon Sep 17 00:00:00 2001 From: Andrew Noyes Date: Fri, 15 Mar 2024 17:23:02 -0700 Subject: [PATCH] Use assume It works now that we fell back to the __builtin_unreachable based implementation for gcc. --- ConflictSet.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/ConflictSet.cpp b/ConflictSet.cpp index 84313db..742abae 100644 --- a/ConflictSet.cpp +++ b/ConflictSet.cpp @@ -374,10 +374,8 @@ inline void Node16::copyChildrenAndKeyFrom(const Node48 &other) { other.bitSet.forEachInRange( [&](int c) { // Suppress a false positive -Waggressive-loop-optimizations warning - // in gcc. `assume` doesn't work for some reason. - if (!(i < Node16::kMaxNodes)) { - __builtin_unreachable(); // GCOVR_EXCL_LINE - } + // in gcc + assume(i < Node16::kMaxNodes); index[i] = c; children[i] = other.children[other.index[c]]; assert(children[i].child->parent == &other); @@ -430,10 +428,8 @@ inline void Node48::copyChildrenAndKeyFrom(const Node256 &other) { bitSet.forEachInRange( [&](int c) { // Suppress a false positive -Waggressive-loop-optimizations warning - // in gcc. `assume` doesn't work for some reason. - if (!(i < Node48::kMaxNodes)) { - __builtin_unreachable(); // GCOVR_EXCL_LINE - } + // in gcc. + assume(i < Node48::kMaxNodes); index[c] = i; children[i] = other.children[c]; assert(children[i].child->parent == &other);