PR79697: Delete calls to strdup, strndup, realloc if there is no lhs

Prathamesh Kulkarni prathamesh.kulkarni@linaro.org
Tue Apr 25 07:01:00 GMT 2017


On 25 April 2017 at 02:41, Jeff Law <law@redhat.com> wrote:
> On 02/25/2017 01:40 AM, Prathamesh Kulkarni wrote:
>>
>> Hi,
>> The attached patch deletes calls to strdup, strndup if it's
>> return-value is unused,
>> and same for realloc if the first arg is NULL.
>> Bootstrap+tested on x86_64-unknown-linux-gnu.
>> OK for GCC 8 ?
>>
>> Thanks,
>> Prathamesh
>>
>>
>> pr79697-1.txt
>>
>>
>> 2017-02-25  Prathamesh Kulkarni<prathamesh.kulkarni@linaro.org>
>>
>>         PR tree-optimization/79697
>>         * tree-ssa-dce.c (mark_stmt_if_obviously_necessary): Check if
>> callee
>>         is BUILT_IN_STRDUP, BUILT_IN_STRNDUP, BUILT_IN_REALLOC.
>>
>> testsuite/
>>         * gcc.dg/tree-ssa/pr79697.c: New test.
>
> OK for the trunk.
Hi Jeff,
Did you intend to approve the original patch (pr79697-1.txt) or the
latest one (pr79697-3.txt that also folds realloc (0, n) to malloc
(n)) ?

Thanks,
Prathamesh
>
> jeff
>



More information about the Gcc-patches mailing list