On 09/17/2018 11:15 PM, Marc Glisse wrote:
On Mon, 17 Sep 2018, François Dumont wrote:

We talk about it a while back.

I've run testsuite several times since I have this patch on my local copy. Note that when I implemented it the wrong way tests started to fail so it is clearly having an effect on the generated code.

* include/bits/c++config [__OPTIMIZE__](__glibcxx_assert): Define as optimization hint

using __builtin_unreachable.

Ok to commit ?

I see for instance in bits/regex_automaton.tcc:

              __glibcxx_assert(__m.count(__ref._M_next) > 0);

where __m is a map, which does not look so well suited for a __builtin_unreachable. Is it using the wrong macro?

I don't know if this particular code is well covered by the testsuite. So I tweaked several tests in 23_containers/map and the code compiles just fine if it is your concern.

If your concern is rather that the condition got evaluated which will eventually slow down execution then I need to check generated code. Any good link explaining how to have a clear view on the generated code ?

Maybe a 'if __builtin_constant_p(_Condition)' could help if gcc doesn't do it itself already.

Reply via email to