On Fri, Aug 28, 2026 at 3:10 PM Richard Biener <[email protected]> wrote: > > On Thu, 27 Aug 2026, Tamar Christina wrote: > > > > -----Original Message----- > > > From: Richard Biener <[email protected]> > > > Sent: 27 August 2026 12:03 > > > To: [email protected] > > > Cc: Jakub Jelinek <[email protected]>; Tamar Christina > > > <[email protected]>; [email protected] > > > Subject: [PATCH] Remove -ftree-loop-if-convert, tie tree-if-conv.cc to > > > vectorization only > > > > > > The following removes the ability to enable stand-alone loop if-conversion > > > or to disable loop if-conversion even though vectorization runs. This > > > was hardly useful before and testing and coverage of this mode is > > > basically non-existent. Instead phiopt and cselimg are the general > > > if-conversion vehicles. > > > > > > This will allow to more tightly integrate vectorizer loop if-conversion > > > with loop vectorization. > > > > > > I have likely left some dead code removal on the plate and will followup > > > with that if there's consensus on this. > > > > > > Bootstrapped and tested on x86_64-unknown-linux-gnu. > > > > > > There's a few more testcases using -ftree-loop-if-convert, I have > > > left those untouched (but no more target specific testcases). > > > > > > Any comments? > > > > > > Thanks, > > > Richard. > > > > > > * common.opt (ftree-loop-if-convert): Mark as ignored. > > > * doc/invoke.texi (ftree-loop-if-convert): Remove. > > > * tree-ssa-phiopt.cc (cond_if_else_store_replacement): > > > Do not check !flag_tree_loop_if_convert. > > > * tree-if-conv.cc (pass_if_conversion::gate): Only > > > run when loop vectorization is enabled on any loop. > > > (pass_if_conversion::execute): Adjust. > > > (tree_if_conversion): Likewise. Simplify as we now > > > always version. > > > > > > * gcc.dg/vect/bb-slp-pattern-2.c: Adjust. > > > * gcc.target/i386/pr45685.c: Likewise. > > > --- > > > > > > -/* { dg-final { scan-assembler-times "cmov" 6 } } */ > > > +/* { dg-final { scan-assembler-times "cmov" 6 { xfail *-*-* } } } */ > > > diff --git a/gcc/tree-if-conv.cc b/gcc/tree-if-conv.cc > > > index 5d8abfb52b5..23b4e4cd63a 100644 > > > --- a/gcc/tree-if-conv.cc > > > +++ b/gcc/tree-if-conv.cc > > > @@ -4084,7 +4084,7 @@ tree_if_conversion (class loop *loop, vec<gimple *> > > > *preds) > > > bitmap exit_bbs; > > > edge pe; > > > auto_vec<data_reference_p, 10> refs; > > > - bool loop_versioned; > > > + class loop *vloop, *nloop; > > > > > > again: > > > rloop = NULL; > > > @@ -4094,7 +4094,6 @@ tree_if_conversion (class loop *loop, vec<gimple *> > > > *preds) > > > need_to_predicate = false; > > > need_to_rewrite_undefined = false; > > > any_complicated_phi = false; > > > - loop_versioned = false; > > > > > > /* Apply more aggressive if-conversion when loop or its outer loop were > > > marked with simd pragma. When that's the case, we try to if-convert > > > @@ -4147,8 +4146,7 @@ tree_if_conversion (class loop *loop, vec<gimple *> > > > *preds) > > > } > > > } > > > > > > - if ((flag_tree_loop_vectorize || loop->force_vectorize) > > > - && !loop->dont_vectorize) > > > + if (!loop->dont_vectorize) > > > need_to_lower_bitfields = bitfields_to_lower_p (loop, reads_to_lower, > > > writes_to_lower); > > > > > > > LGTM too FWIW, but is this check not redundant? Since in ::execute > > tree_if_conversion won't be called anymore if loop->dont_vectorize no? > > Ah, yes. Also > > if ((need_to_predicate || any_complicated_phi) > && ((!flag_tree_loop_vectorize && !loop->force_vectorize) > || loop->dont_vectorize)) > goto cleanup; > > I fixed that and also elided the loop_versioned argument from the > call chain to convert_scalar_cond_reduction. I'll re-test and > post the version I'll push. > > Richard. >
This caused: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127122 -- H.J.
