[Bug tree-optimization/105883] Memcmp folded only when size is a power of two

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Jun 14 07:18:00 GMT 2022


Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
   Last reconfirmed|                            |2022-06-14
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
memcmp is folded when it can be turned into two loads and a comparison - that
doesn't work for non-power-of-two sizes.  Fully constant folding the loads
isn't attempted - in theory value-numbering could use partial def tracking to
equal prefixes and fold on different known bytes but I think this is all hardly
worth the trouble?

Who will write such code anyway.

More information about the Gcc-bugs mailing list