[Bug tree-optimization/82732] malloc+zeroing other than memset not optimized to calloc, so asm output is malloc+memset
jakub at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Nov 7 16:05:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82732
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |aldyh at gcc dot gnu.org,
| |jakub at gcc dot gnu.org,
| |law at gcc dot gnu.org
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
So, either we need on-demand VRP for this, or
tree niters = number_of_latch_executions (loop);
niters = fold_convert_loc (loc, sizetype, niters);
if (dominated_by_p (CDI_DOMINATORS, single_exit (loop)->src, bb))
niters = size_binop_loc (loc, PLUS_EXPR, niters, size_one_node);
needs to be smarter, dunno if it should look if the loop has a guard that makes
sure the var in niters is non-zero, or something similar. Such guards are
common though, so perhaps the niters infrastructure should be able to do that.
Have number_of_latch_executions alternative that would add one to that if
needed and take into account the possible preheaders.
More information about the Gcc-bugs
mailing list