On 10/10/18 7:57 PM, Peter Bergner wrote: > The problem is, that hard reg %r26 is defined in insn 32, to be used in > insn 33, so using %r26 as the reload reg is wrong, because it will clobber > the value we set in insn 32. Looking thru LRA, it looks like LRA assumes > that for a reload, if one of the input pseudos dies in the insn, then the > hard reg it was assigned to is available to use. That assumption is (now) > wrong, because another pseudo may be using that hard reg or in this case, > the hard reg itself is still live. > > For this example, pseudo 109 also dies in insn 49 and since it's hard reg > %r28 isn't live thru the insn, we could have used that instead. However, > we cannot just look at REG_DEAD notes for free hard regs to use for reload > regs. We need to make sure that that hard reg isn't also assigned to another > pseudo that is live at that insn or even that the hard reg itself is live. > > Vlad, you know the LRA code better than anyone. Will it be easy to find > all the places where we create reload regs and fix them up so that we > look at more than just REG_DEAD notes? Even though looking at REG_DEAD > notes isn't enough, I still think the majority of the time those regs > probably will be free to use, we just have to check for the special > cases like above where they are not.
Ok, after working in gdb, I see that the PA-RISC port still uses reload and not LRA, but it too seems to have the same issue of reusing input regs that have REG_DEAD notes, so the question still stands. It's just that whatever fix we come up with will have to be to both LRA and reload. Peter