http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21855
--- Comment #21 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-01-10 16:57:36 UTC --- The Java frontend could handle this by performing loads of the length field via a SAVE_EXPR and sharing this across a function. That way CSE would happen automagically.