re PR tree-optimization/57742 (memset(malloc(n),0,n) -> calloc(n,1))
commit24314386b32b93c759c6722a2c18facae15128ea
authorMarc Glisse <marc.glisse@inria.fr>
Tue, 24 Jun 2014 18:50:00 +0000 (24 20:50 +0200)
committerMarc Glisse <glisse@gcc.gnu.org>
Tue, 24 Jun 2014 18:50:00 +0000 (24 18:50 +0000)
tree81ba342aeb4db1f2fe70e25917fc6972499cd2d2
parent84e0f57e35738500e44fd21753e31295d4700bfb
re PR tree-optimization/57742 (memset(malloc(n),0,n) -> calloc(n,1))

2014-06-24  Marc Glisse  <marc.glisse@inria.fr>

PR tree-optimization/57742
gcc/
* tree-ssa-strlen.c (get_string_length): Ignore malloc.
(handle_builtin_malloc, handle_builtin_memset): New functions.
(strlen_optimize_stmt): Call them.
* passes.def: Move strlen after loop+dom but before vrp.
gcc/testsuite/
* g++.dg/tree-ssa/calloc.C: New testcase.
* gcc.dg/tree-ssa/calloc-1.c: Likewise.
* gcc.dg/tree-ssa/calloc-2.c: Likewise.
* gcc.dg/strlenopt-9.c: Adapt.

From-SVN: r211956
gcc/ChangeLog
gcc/passes.def
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/tree-ssa/calloc.C [new file with mode: 0644]
gcc/testsuite/gcc.dg/strlenopt-9.c
gcc/testsuite/gcc.dg/tree-ssa/calloc-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/tree-ssa/calloc-2.c [new file with mode: 0644]
gcc/tree-ssa-strlen.c