On 11/15/2021 10:33 AM, Siddhesh Poyarekar wrote:
Avoid going through another folding cycle and use the ignore flag to
directly transform BUILT_IN_STPCPY_CHK to BUILT_IN_STRCPY when set,
likewise for BUILT_IN_STPNCPY_CHK to BUILT_IN_STPNCPY.

Dump the transformation in dump_file so that we can verify in tests that
the direct transformation actually happened.

gcc/ChangeLog:

        * gimple-fold.c (dump_transformation): New function.
        (gimple_fold_builtin_stxcpy_chk,
        gimple_fold_builtin_stxncpy_chk): Use it.  Simplify to
        BUILT_IN_STRNCPY if return value is not used.

gcc/testsuite/ChangeLog:

        * gcc.dg/fold-stringops.c: New test.
OK
jeff

Reply via email to