https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116142

--- Comment #12 from rguenther at suse dot de <rguenther at suse dot de> ---
On Tue, 6 Aug 2024, xry111 at gcc dot gnu.org wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116142
> 
> --- Comment #11 from Xi Ruoyao <xry111 at gcc dot gnu.org> ---
> (In reply to rguent...@suse.de from comment #10)
> > On Thu, 1 Aug 2024, xry111 at gcc dot gnu.org wrote:
> > 
> > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116142
> > > 
> > > --- Comment #9 from Xi Ruoyao <xry111 at gcc dot gnu.org> ---
> > > In the following call stack:
> > > 
> > > #0  single_imm_use (var=0x7ffff564a3a8, use_p=0x7fffffffc9d8, 
> > >     stmt=0x7fffffffc9e0) at ../../gcc/gcc/ssa-iterators.h:427
> > > #1  0x0000000001aabcde in vec_info::lookup_single_use (this=0x33a1b80, 
> > >     lhs=0x7ffff564a3a8) at ../../gcc/gcc/tree-vectorizer.cc:581
> > > #2  0x0000000001a1a40a in supportable_widening_operation 
> > > (vinfo=0x33a1b80, 
> > >     code=..., stmt_info=0x3482b50, vectype_out=0x7ffff595a1f8, 
> > >     vectype_in=0x7ffff595a000, code1=0x7fffffffcb90, 
> > > code2=0x7fffffffcb94, 
> > >     multi_step_cvt=0x7fffffffcba0, interm_types=0x7fffffffcc48)
> > >     at ../../gcc/gcc/tree-vect-stmts.cc:14196
> > > #3  0x00000000019f7c2d in vectorizable_conversion (vinfo=0x33a1b80, 
> > >     stmt_info=0x3482b50, gsi=0x0, vec_stmt=0x0, slp_node=0x33b4cc8, 
> > >     cost_vec=0x7fffffffd190) at ../../gcc/gcc/tree-vect-stmts.cc:5438
> > > #4  0x0000000001a16ecc in vect_analyze_stmt (vinfo=0x33a1b80, 
> > >     stmt_info=0x3482b50, need_to_vectorize=0x7fffffffcf73, 
> > > node=0x33b4cc8, 
> > >     node_instance=0x32fb6e0, cost_vec=0x7fffffffd190)
> > >     at ../../gcc/gcc/tree-vect-stmts.cc:13291
> > > 
> > > "ptr == ptr->next" is satisfied (the comment says it means "there aren't 
> > > any
> > > uses whatsoever" but I don't really understand it: I knows almost nothing 
> > > about
> > > tree vectorization) and single_imm_use directly returns false.
> > 
> > So likely 
> > 
> >           tree lhs = gimple_assign_lhs (stmt_info->stmt);
> >           stmt_vec_info use_stmt_info = loop_info->lookup_single_use 
> > (lhs);
> >           if (use_stmt_info
> > 
> > needs to be
> > 
> >           tree lhs = gimple_assign_lhs (vect_orig_stmt (stmt_info)->stmt);
> >           stmt_vec_info use_stmt_info = loop_info->lookup_single_use 
> > (lhs);
> 
> Works for me!

Can you produce, test and post a patch?

Reply via email to