[Bug tree-optimization/38592] Optimize memmove / memcmp combination
msebor at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Aug 15 15:17:00 GMT 2017
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.)
More information about the Gcc-bugs
mailing list