This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/85637] Unneeded store of member variables in inner loop
- From: "petschy at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 03 May 2018 21:36:42 +0000
- Subject: [Bug middle-end/85637] Unneeded store of member variables in inner loop
- Auto-submitted: auto-generated
- References: <bug-85637-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85637
--- Comment #2 from petschy at gmail dot com ---
Thanks. For non-char types, one can use __restrict on ptrs, but for chars it
doesn't work, unfortunately (strict aliasing rules). Is there a way to tell the
compiler that a char ptr doesn't alias anything in the function? The current
behaviour pessimizes any code that does byte I/O with classes, if I understand
the rules correcly:
- for const char* it assumes that members might be read through the ptr, so it
stores them back after an update
- for char* it assumes that after a write, any members in registers must be
re-loaded as the write might have changed them.