This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PING] [patch] PR tree-optimizations/26969 (vectorizer)


> Victor Kaplansky wrote on 08/01/06 07:41:
>
> >         PR tree-optimization/26969
> >         * tree-vect-analyze.c (vect_analyze_loop_form): Add check of
latch
> >          witch an empty list of PHIs.
witch --> with

Also note that with this fix this PR should become a missed optimization
PR.

In fact, the phi node in question, which fails vectorization, looks
redundant:

loop:
      SMT.6_16 = phi <SMT.6_1, SMT.6_12>
      ....
      # SMT.6_13 = V_MAY_DEF <SMT.6_16>
      if (...) goto latch else goto exit
latch:
      SMT.6_1 = phi <SMT.6_13>
      goto loop

the code could be transformed into the following (replace use of SMT.6_1
with use of SMT.6_13 and delete the redundant phi):

loop:
      SMT.6_16 = phi <SMT.6_13, SMT.6_12>
      ....
      # SMT.6_13 = V_MAY_DEF <SMT.6_16>
      if (...) goto latch else goto exit
latch:
      goto loop

So I think we should just clean away these redundant latch-block phis. The
question is what's the best way to do that - do a loop_dce pass before
vectorization? is there a more appropriate phi-node cleanup pass? or just
do this cleanup from within the vectorizer? I think it's an easy special
case - we only work with loops whose latch block is empty, has one
predecessor and one successor, and the result (def) of any phi_node in a
latch block would be used only by the loop header phi nodes. right? seems
like we could always get rid of these phis under these circumstances.

thanks,
dorit

> >
> OK.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]