Andrew Pinski wrote: > On Fri, Oct 10, 2008 at 11:14 AM, Andrew Haley <[EMAIL PROTECTED]> wrote: >> Richard Guenther wrote: >>> On Fri, Oct 10, 2008 at 7:55 PM, Andrew Haley <[EMAIL PROTECTED]> wrote: >>>> I have some broken code, compiled from Java source. >>>> >>>> It looks like: >>>> >>>> D.843 = &java.text.Collator.class$$; >>>> _Jv_InitClass (D.843); >>>> D.845 = &_CD_java_text_Collator; >>>> >>>> is being turned into: >>>> >>>> D.843 = &java.text.Collator.class$$; >>>> D.845 = &_CD_java_text_Collator; >>>> _Jv_InitClass (D.843); >>> This is always a valid transformation. >>> >>>> i.e. the memory reference is moved to before the call to _Jv_InitClass. >>> There is no memory reference in the above case, it seems just the address >>> of _CD_java_text_Collator is taken. >>> >>> Or maybe I'm missing sth? >> In the RTL code it moves the mem ref, not just the address: >> >> (call (mem:QI (symbol_ref:DI ("_Jv_InitClass") [flags 0x41] >> >> (set (reg/f:DI 95 [ #ref#8#1 ]) >> (mem/s/u/f/j:DI (const:DI (plus:DI (symbol_ref:DI >> ("_CD_java_text_Collator") >> (const_int 16 [0x10]))) >> >> is turned to: >> >> (set (reg/f:DI 162 [ #ref#8#1 ]) >> (mem/s/u/f/j:DI (const:DI (plus:DI (symbol_ref:DI >> ("_CD_java_text_Collator") >> (const_int 16 [0x10]))) >> >> ... >> >> (call (mem:QI (symbol_ref:DI ("_Jv_InitClass") > > Well the mem has a /u on it so it is being marked as MEM_READONLY_P so > it is valid optimization. Why it is being marked with MEM_READONLY_P, > I don't know.
Thanks to everyone who responded. I hadn't noticed the /u on the mem. I'll find out why it's marked readonly -- it's probably a FE bug. Thanks, Andrew.