Hi All, This patch adds the basic infrastructure for doing pattern matching on SLP trees. This is done immediately after the SLP tree creation because it can change the shape of the tree in radical ways and so we would like to do it before any analysis is performed on the tree. A new file tree-vect-slp-patterns.c is added which contains all the code for pattern matching on SLP trees. This cover letter is short because the changes are heavily commented. All pattern matchers need to implement the abstract type VectPatternMatch. The VectSimplePatternMatch abstract class provides some default functionality for pattern matchers that need to rebuild nodes. The pattern matcher requires if replacing a statement in a node, that ALL statements be replaced. Bootstrapped Regtested on aarch64-none-linux-gnu and no issues. Ok for master? Thanks, Tamar gcc/ChangeLog: * Makefile.in (tree-vect-slp-patterns.o): New. * doc/passes.texi: Update documentation. * tree-vect-slp.c (vect_match_slp_patterns_2, vect_match_slp_patterns): New. (vect_analyze_slp_instance): Call pattern matcher. * tree-vectorizer.h (class VectPatternMatch, class VectPattern): New. * tree-vect-slp-patterns.c: New file. --