[Bug tree-optimization/18694] [4.0 regression] loop miscompilation at -O1 (-ftree-ch)
------- Additional Comments From kazu at cs dot umass dot edu 2004-12-10 22:25 -------
Subject: Re: [4.0 regression] loop
miscompilation at -O1 (-ftree-ch)
Hi Jeff,
> > Can you come up with a hypothetical scenario?
> No need. It's fundamentally broken in that it's recording
> an invalid equivalence. It's recording that tmp_1 = next_2
> which is totally bogus.
>
> The only reason it works is because we don't walk through
> all the SSA_NAME_VALUEs back to the oldest.
Yes, I was relying on that fact.
Ah, now I see that we have two different definitions of
SSA_NAME_VALUE. Rather than pushing what I think is the right
definition, let's get a correct definition from the author of
tree-ssa-dom.c. :-) Is the following more or less correct?
SSA_NAME_VALUE(X) gives you a gimple min invariant or an SSA_NAME
that has the same value as X. If we do not find a gimple min
invariant for X, we make every effort to make SSA_NAME_VALUE(X)
evaluate to the oldest SSA_NAME that has the same value as X (via
record_const_or_copy, etc), but that is not guaranteed. For the
best result, you may have to walk SSA_NAME_VALUE, but it's
questionable how profitable that is.
The only comment I can find for SSA_NAME_VALUE is this:
/* Get the value of this SSA_NAME, if available. */
#define SSA_NAME_VALUE(N) \
SSA_NAME_CHECK (N)->ssa_name.value_handle
I think it would be helpful to expand the comment for a future
reference. To be honest, given that tree-ssa-dom.c never walks
SSA_NAME_VALUE and that record_const_or_copy makes a transitive
closure of "copy-of" relations, I was under the impression that
SSA_NAME_VALUE gives you the oldest value.
Kazu Hirata
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18694
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
Reply to: