aboutsummaryrefslogtreecommitdiff
path: root/libjava/classpath/java/util/regex
diff options
context:
space:
mode:
authorAndrew Pinski <quic_apinski@quicinc.com>2025-04-18 17:06:33 -0700
committerAndrew Pinski <andrew.pinski@oss.qualcomm.com>2025-09-07 23:56:58 -0700
commitd8c407a7c842a449f8bdb3bffd7e667833427ea4 (patch)
tree60914e6829fe30a23dea851cc8ea67c1dbce8446 /libjava/classpath/java/util/regex
parentb1659de20ec02af42a215132398e1af42e34032e (diff)
downloadgcc-d8c407a7c842a449f8bdb3bffd7e667833427ea4.zip
gcc-d8c407a7c842a449f8bdb3bffd7e667833427ea4.tar.gz
gcc-d8c407a7c842a449f8bdb3bffd7e667833427ea4.tar.bz2
strlen: Don't do the malloc+memset->calloc optimization in some cases [PR83022]
This fixes a long standing (since GCC 5) issue where the malloc+memset->calloc optimization would happen even if the memset was not always executed. This is a varient of Nathan's patch: https://inbox.sourceware.org/gcc-patches/f4b5d106-8176-b7bd-709b-d435188783b0@acm.org/ Jeff Law had suggested to look at probabilities of the basic blocks to see if it is profitable or not; I am not totally convinced that is a good idea. Though this is an extended version of Nathan's patch as it uses post domination to see if the memset is always called after the condition of null-ness. PR tree-optimization/83022 gcc/ChangeLog: * tree-ssa-strlen.cc (last_stmt_ptr_check): New function. (allow_memset_malloc_to_calloc): New function. (strlen_pass::handle_builtin_memset): Check to see if it is a good idea to do the malloc+memset->calloc optimization. (printf_strlen_execute): Free post dom info. gcc/testsuite/ChangeLog: * gcc.dg/tree-ssa/calloc-6.c: New test. * gcc.dg/tree-ssa/calloc-7.c: New test. * gcc.dg/tree-ssa/calloc-8.c: New test. * gcc.dg/tree-ssa/calloc-9.c: New test. Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
Diffstat (limited to 'libjava/classpath/java/util/regex')
0 files changed, 0 insertions, 0 deletions