[Bug rtl-optimization/94026] combine missed opportunity to simplify comparisons with zero

felix.yang at huawei dot com gcc-bugzilla@gcc.gnu.org
Fri Mar 13 03:09:38 GMT 2020


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94026

--- Comment #2 from Fei Yang <felix.yang at huawei dot com> ---
The test case is reduced from spec2017 benchmark.

int FastBoard::count_pliberties(const int i) {
    return count_neighbours(EMPTY, i);
}

// count neighbours of color c at vertex v
int FastBoard::count_neighbours(const int c, const int v) {
    assert(c == WHITE || c == BLACK || c == EMPTY);
    return (m_neighbours[v] >> (NBR_SHIFT * c)) & 7;
}

bool FastBoard::self_atari(int color, int vertex) {
    assert(get_square(vertex) == FastBoard::EMPTY);

    // 1) count new liberties, if we add 2 or more we're safe
    if (count_pliberties(vertex) >= 2) {
        return false;
    }

    ......


More information about the Gcc-bugs mailing list