Hi Richard, Thank you for the detailed review.
We discovered this issue while testing bw_mem benchmarks, where signed integer reductions showed significant performance regression. I attempted a quick fix, but I now understand my approach doesn't align with your architectural direction and has correctness issues. I'll wait for your refactoring work instead. If I can help with testing or any part of the implementation, please let me know. Thanks again for the guidance. Zhongyao On Fri, Oct 10, 2025 at 6:10 PM Richard Biener <rguent...@suse.de> wrote: > > On Fri, 10 Oct 2025, Zhongyao Chen wrote: > > > Enable SLP vectorization for signed integer reductions by teaching the > > vectorizer to walk PLUS_EXPR trees directly, complementing reassociation > > which skips signed types due to undefined overflow semantics. > > Thanks for working on this. Note this is not the direction I want > the code to do - instead vect_is_simple_reduction should no longer > decide on what is a reduction chain and what not but SLP discovery > should (I started some refactoring there to work towards this a > few weeks ago but got distracted). On the SLP side there's the > vect_slp_linearize_chain toolbox that could be extended for this. > > That said, what I did not get to yet is to move reduction chain > discovery to vect_analyze_slp () time, thus get rid of > loop_vinfo->reduction_chains and only work from the reductions. > > What seems to be missing with your attempt is that if we re-associate > signed operations, we have to perform the operations in an unsigned > type. > > Richard. >