]> git.ipfire.org Git - thirdparty/gcc.git/commit
vect: Use vect representative statement instead of original in patch recog [PR115060]
authorFeng Xue <fxue@os.amperecomputing.com>
Thu, 23 May 2024 07:25:53 +0000 (15:25 +0800)
committerFeng Xue <fxue@os.amperecomputing.com>
Tue, 28 May 2024 14:01:40 +0000 (22:01 +0800)
commita3aeff4ce95bd616a2108dc2363d9cbaba53b170
tree4d9fc5a5d0ef3b4daa9e3c6e978531141b969b36
parentd8d70b783765361a8acef70fc9b54db526cd6ff5
vect: Use vect representative statement instead of original in patch recog [PR115060]

Some utility functions (such as vect_look_through_possible_promotion) that are
to find out certain kind of direct or indirect definition SSA for a value, may
return the original one of the SSA, not its pattern representative SSA, even
pattern is involved. For example,

   a = (T1) patt_b;
   patt_b = (T2) c;        // b = ...
   patt_c = not-a-cast;    // c = ...

Given 'a', the mentioned function will return 'c', instead of 'patt_c'. This
subtlety would make some pattern recog code that is unaware of it mis-use the
original instead of the new pattern statement, which is inconsistent wth
processing logic of the pattern formation pass. This patch corrects the issue
by forcing another utility function (vect_get_internal_def) return the pattern
statement information to caller by default.

2024-05-23 Feng Xue <fxue@os.amperecomputing.com>

gcc/
PR tree-optimization/115060
* tree-vect-patterns.cc (vect_get_internal_def): Return statement for
vectorization.
(vect_widened_op_tree): Call vect_get_internal_def instead of look_def
to get statement information.
(vect_recog_widen_abd_pattern): No need to call vect_stmt_to_vectorize.
gcc/tree-vect-patterns.cc