This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: propagating mem expressions


Mihai Burcea wrote:
assume I previously saved the (mem/f:SI (symbol_ref (...)) rtx into mem_insn:
new_insn = gen_rtx (SET, VOIDmode,
mem_insn,
const_insn);

This is probably not wise. pseudo-regs are unique, but pretty much nothing else is. Lots of stuff gets modified in place, and if you have shared rtl bad things can happen. If you are re-using a mem, you should pass it through copy_rtx. This probably doesn't affect your cse problem though.


> const_insn = gen_rtx (CONST_INT, SImode, ivalue)

It is wrong to give a CONST_INT SImode. It must be VOIDmode. You should use GEN_INT here instead of calling gen_rtx. This could explain your problem, if your constants are malformed.

Does anybody have any suggestions as to why the original one is used by the constant propagation passes, but mine isn't ?

Try stepping through cse to see why one works and the other doesn't.


Gcc's support for cse through memory is pretty weak, because of aliasing problems. If there are any other mems in between the set and the use, then it probably won't cse.
--
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]