This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/38592] Optimize memmove / memcmp combination
- From: "msebor at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 15 Aug 2017 14:11:18 +0000
- Subject: [Bug tree-optimization/38592] Optimize memmove / memcmp combination
- Auto-submitted: auto-generated
- References: <bug-38592-4@http.gcc.gnu.org/bugzilla/>
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.)