http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50819
Ira Rosen <irar at il dot ibm.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |ASSIGNED Last reconfirmed| |2011-10-22 CC| |irar at il dot ibm.com AssignedTo|unassigned at gcc dot |irar at gcc dot gnu.org |gnu.org | Ever Confirmed|0 |1 --- Comment #1 from Ira Rosen <irar at il dot ibm.com> 2011-10-22 12:25:30 UTC --- SLP data dependence analysis checks that all the loads are before all the stores in the basic block, and for sum1 we get res_4(D)->theX = D.2306_31; D.2305_32 = res_4(D)->theY; D.2303_34 = D.2289_26 + D.2305_32; res_4(D)->theY = D.2303_34; D.2302_35 = res_4(D)->theZ; D.2300_37 = D.2287_24 + D.2302_35; res_4(D)->theZ = D.2300_37; D.2299_38 = res_4(D)->theT; D.2297_40 = D.2285_22 + D.2299_38; res_4(D)->theT = D.2297_40; while for sum2 the loads and stores are not mixed: D.2391_29 = MEM[(const struct LorentzVector &)res_4(D)].theT; D.2389_31 = D.2365_22 + D.2391_29; D.2388_32 = MEM[(const struct LorentzVector &)res_4(D)].theZ; D.2386_34 = D.2367_24 + D.2388_32; D.2385_35 = MEM[(const struct LorentzVector &)res_4(D)].theY; D.2383_37 = D.2369_26 + D.2385_35; D.2382_38 = MEM[(const struct LorentzVector &)res_4(D)].theX; D.2380_40 = D.2371_28 + D.2382_38; res_4(D)->theX = D.2380_40; res_4(D)->theY = D.2383_37; res_4(D)->theZ = D.2386_34; res_4(D)->theT = D.2389_31; The attached patch relaxes the above check a bit. Since we go through all the ddrs anyway, we can check the order between the loads and the stores in vect_analyze_data_ref_dependence. We don't care about independent load-store pairs, so we only need to add this check to the pairs with unknown dependence. (Known dependencies are already checked in vect_drs_dependent_in_basic_block).