gimple-iterator.c
24.4 KB
-
[11/n] PR85694: Apply pattern matching to pattern definition statements · 41949de9
Although the first pattern match wins in the sense that no later function can match the *old* gimple statement, it still seems worth letting them match the *new* gimple statements, just like we would if the original IR had included that sequence from the outset. This is mostly true after the later patch for PR85694, where e.g. we could recognise: signed char a; int ap = (int) a; int res = ap * 3; as the pattern: short ap' = (short) a; short res = ap' * 3; // S1: definition statement int res = (int) res; // S2: pattern statement and then apply the mult pattern to "ap' * 3". The patch needs to come first (without its own test cases) so that the main over-widening patch doesn't regress anything. 2018-06-30 Richard Sandiford <richard.sandiford@arm.com> gcc/ * gimple-iterator.c (gsi_for_stmt): Add a new overload that takes the containing gimple_seq *. * gimple-iterator.h (gsi_for_stmt): Declare it. * tree-vect-patterns.c (vect_recog_dot_prod_pattern) (vect_recog_sad_pattern, vect_recog_widen_sum_pattern) (vect_recog_widen_shift_pattern, vect_recog_rotate_pattern) (vect_recog_vector_vector_shift_pattern, vect_recog_divmod_pattern) (vect_recog_mask_conversion_pattern): Remove STMT_VINFO_IN_PATTERN_P checks. (vect_init_pattern_stmt, vect_set_pattern_stmt): New functions, split out from... (vect_mark_pattern_stmts): ...here. Handle cases in which the statement being replaced is part of an existing pattern definition sequence, inserting the new pattern statements before the original one. (vect_pattern_recog_1): Don't return a bool. If the statement is already part of a pattern, instead apply pattern matching to the pattern definition statements. Don't clear the STMT_VINFO_RELATED_STMT if is_pattern_stmt_p. (vect_pattern_recog): Don't break after the first match; continue processing the pattern definition statements instead. Don't bail out for STMT_VINFO_IN_PATTERN_P here. From-SVN: r262275
Richard Sandiford committed