re PR tree-optimization/78154 (memcpy et al can be assumed to return non-null)
authorRichard Biener <rguenther@suse.de>
Wed, 23 Nov 2016 10:52:25 +0000 (10:52 +0000)
committerPrathamesh Kulkarni <prathamesh3492@gcc.gnu.org>
Wed, 23 Nov 2016 10:52:25 +0000 (10:52 +0000)
commita5bb8a5ceae1bfb0fa82a58254a6539c8943d4b8
tree5a77749307568d49ccaaa49d8f07d74ede803967
parente36c1cfe080b1f8150e28eb45ef8e190df1dd6ef
re PR tree-optimization/78154 (memcpy et al can be assumed to return non-null)

2016-11-23  Richard Biener  <rguenther@suse.de>
    Prathamesh Kulkarni  <prathamesh.kulkarni@linaro.rog>

PR tree-optimization/78154
* tree-vrp.c (gimple_stmt_nonzero_warnv_p): Return true if function
returns it's argument and the argument is nonnull.
* builtin-attrs.def: Define ATTR_RETURNS_NONNULL,
ATT_RETNONNULL_NOTHROW_LEAF.
* builtins.def (BUILT_IN_MEMPCPY): Change attribute to
ATTR_RETNONNULL_NOTHROW_LEAF.
(BUILT_IN_STPCPY): Likewise.
(BUILT_IN_STPNCPY): Likewise.
(BUILT_IN_MEMPCPY_CHK): Likewise.
(BUILT_IN_STPCPY_CHK): Likewise.
(BUILT_IN_STPNCPY_CHK): Likewise.
(BUILT_IN_STRCAT): Change attribute to ATTR_RET1_NOTHROW_NONNULL_LEAF.
(BUILT_IN_STRNCAT): Likewise.
(BUILT_IN_STRNCPY): Likewise.
(BUILT_IN_MEMSET_CHK): Likewise.
(BUILT_IN_STRCAT_CHK): Likewise.
(BUILT_IN_STRCPY_CHK): Likewise.
(BUILT_IN_STRNCAT_CHK): Likewise.
(BUILT_IN_STRNCPY_CHK): Likewise.

testsuite/
* gcc.dg/tree-ssa/pr78154.c: New test.

Co-Authored-By: Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
From-SVN: r242745
gcc/ChangeLog
gcc/builtin-attrs.def
gcc/builtins.def
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/tree-ssa/pr78154.c [new file with mode: 0644]
gcc/tree-vrp.c