On Fri, Jan 13, 2012 at 12:01 AM, Eric Botcazou <ebotca...@adacore.com> wrote: >> The solution is to fix the scanning loop to look into the insn pattern >> itself for all set and clobbered hard registers. This way, all >> registers, clobbered by the pattern, will be correctly marked in the >> "live" bitmap, including FLAGS register that is ignored by current >> approach. >> >> 2012-01-12 Uros Bizjak <ubiz...@gmail.com> >> >> * recog.c (peep2_find_free_register): Determine clobbered registers >> from insn pattern. > > Is that a complete solution though? Don't we need to do more, for example > because of peep2_reg_dead_p and peep2_update_life? These are not rhetorical > questions, but genuine ones; it's a little disturbing to discover such a flaw > in this kind of code after all these years (I can reproduce the problem with > all the compilers of the 4.x series, so this didn't work with flow.c either).
Yes, it is a complete solution. Tracking register liveness is different issue, and a register is indeed dead after instruction, if it has been clobbered by insn, or when marked unused. This works OK, and there are many examples of peep2_{reg|regno}_dead_p usag in i386.md. The problem my patch solves is the answer to the question "Is the choosen non-live temporary register untouched over the insn sequence?". The answer: "Yes, if it was not set or clobbered by any insn in the sequence". Uros.