http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54717
--- Comment #12 from Sergey Ostanevich <sergos.gnu at gmail dot com> 2012-11-14 18:56:22 UTC --- Actually, it is not. I found that PRE did not collected a memory access within the loop that caused later missing vectorization. Here is dump before (good one) and after the commit (bad one) <bb 88>: pretmp_263 = (integer(kind=8)) ival2_82; pretmp_264 = pretmp_263 + -1; pretmp_265 = *xxtrt_46(D)[pretmp_264]; <bb 28>: # ival2_10 = PHI <ival2_63(88), ival2_89(92)> # ival2_14 = PHI <ival2_82(88), ival2_15(92)> # prephitmp_266 = PHI <pretmp_265(88), prephitmp_237(92)> _83 = (integer(kind=8)) ival2_10; _84 = _83 + -1; _85 = *xxtrt_46(D)[_84]; _86 = (integer(kind=8)) ival2_14; _87 = _86 + -1; _88 = prephitmp_266; if (_85 < _88) goto <bb 29>; else goto <bb 90>; <bb 90>: goto <bb 30>; <bb 29>: <bb 30>: # ival2_15 = PHI <ival2_14(90), ival2_10(29)> # prephitmp_237 = PHI <_88(90), _85(29)> ival2_89 = ival2_10 + -1; if (ival2_10 == ipos1_12) goto <bb 91>; else goto <bb 92>; <bb 92>: goto <bb 28>; --------------------------------- <bb 88>: <bb 28>: # ival2_10 = PHI <ival2_63(88), ival2_89(92)> # ival2_14 = PHI <ival2_82(88), ival2_15(92)> _83 = (integer(kind=8)) ival2_10; _84 = _83 + -1; _85 = *xxtrt_46(D)[_84]; _86 = (integer(kind=8)) ival2_14; _87 = _86 + -1; _88 = *xxtrt_46(D)[_87]; if (_85 < _88) goto <bb 29>; else goto <bb 90>; <bb 90>: goto <bb 30>; <bb 29>: <bb 30>: # ival2_15 = PHI <ival2_14(90), ival2_10(29)> ival2_89 = ival2_10 + -1; if (ival2_10 == ipos1_12) goto <bb 91>; else goto <bb 92>; <bb 92>: goto <bb 28>; ------------------------- So for the loop that starting at bb 28 you can see the xxtrt_46 access was not put into pretemp. Possible reason is exactly as it was mentioned by Richard - there were extra candidates collected and this one become less anticipatable Skipping partial partial redundancy for expression {array_ref<pretmp_8,0,4>,mem_ref<0B>,xxtrt_46(D)}@.MEM_30(D) (0165) not partially anticipated on any to be optimized for speed edges ----------------------------------------------------------------------- Found partial partial redundancy for expression {array_ref<pretmp_8,0,4>,mem_ref<0B>,xxtrt_46(D)}@.MEM_30(D) (0165) Created phi prephitmp_237 = PHI <_88(90), _85(29)> in block 30