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: Re: LOOP_HEADER tree code?


On 10/26/06, Steven Bosscher <stevenb.gcc@gmail.com> wrote:

It is not a note, it's a statement. The problem with RTL loop notes
was that they were not statements, but rather markers, e.g. "a loop
starts/ends here".  The LOOP_HEADER node, on the other hand, is more
like a placeholder for the result of the number of iterations
computation. Basically it is a statement that does not produce a
result, but does have uses.

I don't see why a code motion pass would have to worry about the
LOOP_HEADER node.

As a general statement, they do, see below:
The LOOP_HEADER node is before the loop, IIUC, so
any code moved out of the loop would not affect the value of the use
operand for the LOOP_HEADER (by definition, because we're in SSA form
so DEFs inside the loop can't reach the LOOP_HEADER node).

However, if you want to hoist the definition of one of those uses used by the LOOP_HEADER node even further, you have to either know you can *always* hoist the LOOP_HEADER node (IE that it's uses mean nothing), or make sure to choose a block to hoist to that also dominates the LOOP_HEADER node, or you'll violate the SSA property.

This is rarely going to make any difference (i'm actually not sure
it's even possible for it to matter except for irreducible loops), but
it is still something to consider.

Also, if we are talking about a node that looks like

new_value = LOOP_HEADER_NODE <old_value>

and not

LOOP_HEADER_NODE <old_value>
<more uses of old_value>

then it can cause annoyance because you ahve to teach things like
value numbering that it all uses of old_value are the same as
new_value (IE it is a copy).


Gr. Steven



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