Commit Message

Hi!
The reduction_list hash table in parloops is hashed using htab_hash_pointer
on the gimple stmt and later on htab_traversed with code generation in the
callback, which not only can cause code differences with -g/-g0, but also
with AS randomization could result in different generated code.
Unfortunately, the pass changes the result SSA_NAME of the PHI, so we
can't use its SSA_NAME_VERSION all the time as the hash value, and during
gather_scalar_reductions we can't use gimple_uid, as it is used by the
vectorizer. So, this patch starts using SSA_NAME_VERSION, at the end
of gather_scalar_reductions sets gimple_uid of the PHIs to the corresponding
SSA_NAME_VERSION and afterwards in reduction_phi uses gimple_uid.
Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
2010-12-16 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/46969
* tree-parloops.c (struct reduction_info): Add reduc_version.
(reduction_info_hash): Return reduc_version field.
(reduction_phi): Set reduc_version to gimple_uid (phi).
(build_new_reduction): Set reduc_version to SSA_NAME_VERSION of
phi result.
(set_reduc_phi_uids): New function.
(gather_scalar_reductions): Call it at the end through htab_traverse.
* gcc.dg/autopar/pr46969.c: New test.
Jakub