]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
vect: Fix single_imm_use in tree_vect_patterns
authorFeng Xue <fxue@os.amperecomputing.com>
Fri, 14 Jun 2024 07:49:23 +0000 (15:49 +0800)
committerFeng Xue <fxue@os.amperecomputing.com>
Mon, 29 Jul 2024 06:50:00 +0000 (14:50 +0800)
Since pattern statement coexists with normal statements in a way that it is
not linked into function body, we should not invoke utility procedures that
depends on def/use graph on pattern statement, such as counting uses of a
pseudo value defined by a pattern statement. This patch is to fix a bug of
this type in vect pattern formation.

2024-06-14 Feng Xue <fxue@os.amperecomputing.com>

gcc/
* tree-vect-patterns.cc (vect_recog_bitfield_ref_pattern): Only call
single_imm_use if statement is not generated from pattern recognition.

gcc/tree-vect-patterns.cc

index 5fbd1a4fa6b4c4cb75a7a80d0f9d695ab1db4092..4674a16d15f472636ca6636f661188a3c718b0f0 100644 (file)
@@ -2702,7 +2702,8 @@ vect_recog_bitfield_ref_pattern (vec_info *vinfo, stmt_vec_info stmt_info,
   /* If the only use of the result of this BIT_FIELD_REF + CONVERT is a
      PLUS_EXPR then do the shift last as some targets can combine the shift and
      add into a single instruction.  */
-  if (lhs && single_imm_use (lhs, &use_p, &use_stmt))
+  if (lhs && !is_pattern_stmt_p (stmt_info)
+      && single_imm_use (lhs, &use_p, &use_stmt))
     {
       if (gimple_code (use_stmt) == GIMPLE_ASSIGN
          && gimple_assign_rhs_code (use_stmt) == PLUS_EXPR)