[Bug middle-end/40979] induct benchmark 60% slower when compiled with -fgraphite-identity

spop at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Feb 1 16:47:00 GMT 2011


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40979

--- Comment #15 from Sebastian Pop <spop at gcc dot gnu.org> 2011-02-01 16:46:54 UTC ---
The vectorizer does not apply because it does not match the canonical
form of a reduction: here is the reduction after graphite-identity:

        # l12__lsm.18_179 = PHI <l12__lsm.18_183(5), l12__lsm.18_154(7)>
S1:        l12_lower_188 = l12__lsm.18_179;
        l12_lower_184 = D.1589_34 + l12_lower_188;
S2:        l12__lsm.18_154 = l12_lower_184;

Without S1 and S2, this would be recognized as a reduction by the
vectorizer.

Why we end up with the two extra copies?
Here is the original code:

        # l12_lower_5 = PHI <l12_lower_4(4), l12_lower_36(6)>
        l12_lower_36 = D.1589_321 + l12_lower_5;

Graphite does the following:

        l12_lower_5 = *l12_43(D);
        l12_lower_36 = D.1589_321 + l12_lower_5;
        *l12_43(D) = l12_lower_36;

Note that at this point we cannot construct this code because we use
data references and we are in Gimple form:

        *l12_43(D) = D.1589_321 + *l12_43(D);

So I think that the code produced by Graphite is fine, and the problem
is in the cleanups that we're doing after: for instance loop invariant
motion could be improved to avoid the extra two statements S1 and S2:

        # l12__lsm.18_179 = PHI <l12__lsm.18_183(5), l12__lsm.18_154(7)>
S1:        l12_lower_188 = l12__lsm.18_179;
        l12_lower_184 = D.1589_34 + l12_lower_188;
S2:        l12__lsm.18_154 = l12_lower_184;

I also have tried to run pass_rename_ssa_copies but that would just
rename the base variable l12__lsm.18 into l12_lower and wait for the
out-of-SSA to remove the extra copies.  Constant propagation does not
help either... any other suggestions?



More information about the Gcc-bugs mailing list