https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99101

--- Comment #22 from Michael Matz <matz at gcc dot gnu.org> ---
Over the last days I came to a similar conclusion.  Control dependence as
defined
with postdoms doesn't capture the number of invocations of an instruction, just
wether it's invoked at all.  I.e. paths with and without cycles are regarded
the
same on that level.

Basically the path expression for the testcase is (just inner loop):

  (bb11 -> bb4 -> ((bb5->bb9) | (bb6 -> (bb7->leave-cycle | bb9))))*

It's clear that bb7 is reached exactly once (because as soon as it's reached
it's
also the end of this function, and it must be reached because it's the only end
of
the function).

The thing with bb6 is that it can be invoked many times, and doesn't always
need
to lead to bb7, but rather can fall into bb9 (and the cycle restarts).
But it's also the case that bb6 doesn't need to be invoked in _all_ invocations
of
the cycle.  bb4 can choose to skip it (via bb5->bb9).

So, while it's true that bb6 and bb7 are not control dependend on bb4 in the
post-domincance formulation it's pretty clear that bb4 isn't useless because it
exactly can cause bb6 to be skipped _in the current cycle_.

If control dependence via postdoms doesn't capture the number of invocations
of a node then it simply cannot be used in cyclic regions to determine
uselessness
of predicates.

Reply via email to