https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79697
--- Comment #8 from prathamesh3492 at gcc dot gnu.org --- Author: prathamesh3492 Date: Sat Apr 29 10:05:13 2017 New Revision: 247407 URL: https://gcc.gnu.org/viewcvs?rev=247407&root=gcc&view=rev Log: 2017-04-29 Prathamesh Kulkarni <prathamesh.kulka...@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. (propagate_necessity): Check if def_callee is BUILT_IN_STRDUP or BUILT_IN_STRNDUP. * gimple-fold.c (gimple_fold_builtin_realloc): New function. (gimple_fold_builtin): Call gimple_fold_builtin_realloc. testsuite/ * gcc.dg/tree-ssa/pr79697.c: New test. Added: trunk/gcc/testsuite/gcc.dg/tree-ssa/pr79697.c Modified: trunk/gcc/ChangeLog trunk/gcc/gimple-fold.c trunk/gcc/testsuite/ChangeLog trunk/gcc/tree-ssa-dce.c