------- Comment #22 from stevenb dot gcc at gmail dot com 2008-01-21 14:29 ------- Subject: Re: [4.3 Regression] gfortran.dg/array_constructor_9.f90
On 21 Jan 2008 13:25:23 -0000, zadeck at naturalbridge dot com <gcc- > I understand that, that is why if the pass does not specify DF_EQ_NOTES, > the lr (and the rest of the info) stays as it is now. But if you are > building chains out of them, then you are treating them as live anyway. This is not really true. You are treating the registers as "reaching", i.e. even though the register is not live at the point of the REG_EQ* note, it _could_ be live holding the value expected for the REG_EQ* note. This difference between live registers and reaching definitions is also why I feel so uncomfortable about the RD patch. After trimming, DEFs that reach a certain point in the program don't show up in the reaching definitions anymore. You've already found one example how this can be confusing (the loop IV problem). It also breaks my new const/copy prop pass, which expects definitions to reach points where the register of the reaching def is not live. What is confusing about all this, is that in GCC there is nothing to prevent you from inserting a new SET of a register between a previous set of the register and a use in an REG_EQ* note, if the register is dead at the point of the REG_EQ* note. E.g. it is perfectly OK to have a situation like this: (insn 1 (set (reg1) (...))) (insn 2 (...) REG_DEAD (reg1)) (insn 3 (...) REG_EQUAL (... ((reg1) ...))) and nothing in the compiler will object if you would insert a new insn like so: (insn 1 (set (reg1) (...))) (insn 2 (...) REG_DEAD (reg1)) (insn 4 (set (reg1) (...))) (insn 3 (...) REG_EQUAL (... ((reg1) ...))) even though this would probably result in wrong code. The way GCC avoids this kind of situation, is by never re-using registers this way, unless the new definition sets reg1 to the same value (gcse PRE does this, for example). The effect of including REG_* notes in the LR and LIVE problems would be to extend the live ranges of pseudos into regions where they are not actually live. What it comes down to, is that it seems that liveness is not a good condition to trim reaching definitions. Trimming LIVE with LR makes sense because the result of the problem does not change, and the nature of the problems are the same (i.e. compute two meanings of liveness for registers). Live registers and reaching definitions, on the other hand, are dissimilar problems. For LIVE, the effect of trimming is to not compute partial availability in regions where a register is not live. The similar condition for reaching definitions is not liveness, but absence of uses. To trim reaching definitions, one should really be looking at the last reachable use of a definition, and trim from there. I don't know what problem computes the last use of a register, but it may well be a problem that is equivalent to the LR problem, but considering *all* uses including REG_EQ* uses, instead of only real uses. But I haven't thought about this much yet, I must admit. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34884