On 11/10/2021 10:47 AM, Siddhesh Poyarekar wrote:
Use the ignore flag to transform BUILT_IN_STPCPY_CHK to BUILT_IN_STRCPY
when set.  This transformation will happen in a subsequent fold anyway
but do it right away and save the additional effort.

gcc/ChangeLog:

        * gimple-fold.c (gimple_fold_builtin_stxcpy_chk,
        gimple_fold_builtin_stxncpy_chk): Use BUILT_IN_STRNCPY if return
        value is not used.
OK.

Note we usually want testcases for this kind of stuff too.  It's not strictly necessary, but it's hard to go wrong if you're including a test that verifies your transformation happens at the point where you expect it to happen.


Jeff

Reply via email to