Hello, > On 10/25/06, Steven Bosscher <[EMAIL PROTECTED]> wrote: > > > >So you would mark n_1 with TREE_USED, and never let it be removed? > >What would happen if e.g. the entire loop turns out to be dead code? > >Or if the loop is rewritten (e.g. vectorized) in a way that changes > >the number of iterations of the loop? Then the assignment to n_1 would > >be _really_ dead, but there wouldn't be any way to tell. > > When it is really dead, you'll have to remove LOOP_HEADER node > anyway.
if the loop becomes unreachable, the LOOP_HEADER statement gets removed like any other statement. If there are some changes to the structure of the loop (the loop is cancelled by some optimizer, or the number of iterations changes), the optimizer is required to update loop structures, and LOOP_HEADER node is removed/updated in the progress. These updates need to be done on very few places (basically only in the routines provided to manipulate the loop structures). What is quite important, it is possible to verify the correctness of the code (from e.g. verify_flow_info), and thus quickly catch any problems. > Right ? Why not instead reset the TREE_USED bit and let DCE do > its job ? Many optimizers would need to be taught to know about TREE_USED (or any other bit you would use for that). We do not have this type of restriction for any other ssa names, so this would be brand new functionality (on the other hand, most optimizers would not need to know anything special about LOOP_HEADER statements). This definitely is not a way I would take if I decide not to use LOOP_HEADER. I would probably add some sort of "implicit" uses placed on some basic blocks (or in loops). It would be a bit more difficult to teach the relevant optimizers to know about these uses, but at least I won't be introducing a new brand of ssa names that behave differently than all the other ssa names. Zdenek