https://gcc.gnu.org/bugzilla/show_bug.cgi?id=38592

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |msebor at gcc dot gnu.org
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=81703

--- Comment #9 from Martin Sebor <msebor at gcc dot gnu.org> ---
The optimization should be easily doable in tree-ssa-strlen.c.  What makes it
less than straightforward is that gimple-fold.c folds constant size
memcpy/memmove into a MEM_REF which the strlen pass doesn't know how to handle.
 I think the best way is to defer the folding until after the strlen pass has
run.  That will not only make the optimization easily implementable but also
make it possible to detect past the end reads/writes in calls to the functions
because only the strlen pass knows the sizes of the source sequences.  (Bug
81703 tracks another instance of missing strlen optimization due to early
folding.  As an aside, deferring the folding is complementary to handling
MEM_REF in the strlen pass.)

Reply via email to