On 12/05/2016 09:57 AM, Jakub Jelinek wrote:
Hi!

The slightly less recent but also post-6 changes to move memchr
folding from builtins.c to gimple-fold.c and fold-const-call.c also broke
the constexpr handling, it now only constant folds calls that return NULL,
while previously it also handled returning first argument + constant offset.

This patch moves the misplaced memchr handling from fold_const_call_1 to
fold_const_call where similar functions are already handled, fixes
formatting etc. and also handles the case when argument + constant offset
should be returned.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2016-12-05  Jakub Jelinek  <ja...@redhat.com>

        * fold-const-call.c (fold_const_call_1): Remove memchr handling here.
        (fold_const_call) <case CFN_BUILT_IN_STRNCMP,
        case CFN_BUILT_IN_STRNCASECMP>: Formatting improvements.
        (fold_const_call) <case CFN_BUILT_IN_MEMCMP>: Likewise.  If s2 is 0
        and arguments have no side-effects, return 0.
        (fold_const_call): Handle CFN_BUILT_IN_MEMCHR.

        * g++.dg/cpp0x/constexpr-memchr.C: New test.
OK.
jeff

Reply via email to