[Bug tree-optimization/126366] Re-alignment for early break ineffective on x86

"tnfchris at gcc dot gnu.org via Gcc-bugs" <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126366

--- Comment #2 from Tamar Christina <tnfchris at gcc dot gnu.org> ---
Yes masked peeling with PEELED loops are still broken

diff --git a/gcc/tree-vect-data-refs.cc b/gcc/tree-vect-data-refs.cc
index 0e0754769ae..5e9bc869241 100644
--- a/gcc/tree-vect-data-refs.cc
+++ b/gcc/tree-vect-data-refs.cc
@@ -2645,11 +2645,7 @@ vect_enhance_data_refs_alignment (loop_vec_info
loop_vinfo)
   if (!vect_can_advance_ivs_p (loop_vinfo)
       || !slpeel_can_duplicate_loop_p (loop, LOOP_VINFO_MAIN_EXIT
(loop_vinfo),
                                       loop_preheader_edge (loop))
-      || loop->inner
-      /* We don't currently maintain the LCSSA for prologue peeled inversed
-        loops.  */
-      || (LOOP_VINFO_EARLY_BREAKS_VECT_PEELED (loop_vinfo)
-         && !LOOP_VINFO_NITERS_UNCOUNTED_P (loop_vinfo)))
+      || loop->inner)
     do_peeling = false;

   struct _vect_peel_extended_info peel_for_known_alignment;

due to a junk threading of the induction value

;;   basic block 24, loop depth 0, count 65751655 (estimated locally, freq
0.4096), maybe hot
;;    prev block 6, next block 18, flags: (NEW)
;;    pred:       6 [10.0% (guessed)]  count:65751655 (estimated locally, freq
0.4096) (FALSE_VALUE)
  # RANGE [irange] unsigned int [0, 99] MASK 0x7f VALUE 0x0
  # d_98 = PHI <d_11(6)>
  _62 = niters.4_52 - POLY_INT_CST [4, 4];
;;    succ:       18 [always]  count:65751655 (estimated locally, freq 0.4096)
(FALLTHRU)

;;   basic block 18, loop depth 0, count 77309413 (estimated locally, freq
0.4816), maybe hot
;;   Invalid sum of incoming counts 143061068 (estimated locally, freq 0.8912),
should be 77309413 (estimated locally, freq 0.4816)
;;    prev block 24, next block 22, flags: (NEW)
;;    pred:       4 [10.0% (guessed)]  count:77309413 (estimated locally, freq
0.4816) (FALSE_VALUE,EXECUTABLE)
;;                24 [always]  count:65751655 (estimated locally, freq 0.4096)
(FALLTHRU)
  # d_59 = PHI <d_11(4), d_11(24)>
;;    succ:       22 [always]  count:77309413 (estimated locally, freq 0.4816)
(FALLTHRU)

;;   basic block 22, loop depth 0, count 128419524 (estimated locally, freq
0.8000), maybe hot
;;   Invalid sum of incoming counts 90151366 (estimated locally, freq 0.5616),
should be 128419524 (estimated locally, freq 0.8000)
;;    prev block 18, next block 19, flags: (NEW)
;;    pred:       18 [always]  count:77309413 (estimated locally, freq 0.4816)
(FALLTHRU)
;;                13 [10.0% (guessed)]  count:12841953 (estimated locally, freq
0.0800) (TRUE_VALUE)
  # d_61 = PHI <_63(18), 0(13)>
;;    succ:       19 [always]  count:128419524 (estimated locally, freq 0.8000)
(FALLTHRU)

;;   basic block 19, loop depth 1, count 858993463 (estimated locally, freq
5.3512), maybe hot
;;    prev block 22, next block 20, flags: (NEW, REACHABLE, VISITED)
;;    pred:       22 [always]  count:128419524 (estimated locally, freq 0.8000)
(FALLTHRU)
;;                20 [always]  count:730573940 (estimated locally, freq 4.5512)
(FALLTHRU,DFS_BACK,EXECUTABLE)


_63 isn't even in the same subgraph.

Will fix.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.