diff mbox series

vect: Set pattern_stmt_p on the newly created stmt_vec_info

Message ID 20240916031121.1076276-1-quic_apinski@quicinc.com
State New
Headers show
Series vect: Set pattern_stmt_p on the newly created stmt_vec_info | expand

Commit Message

Andrew Pinski Sept. 16, 2024, 3:11 a.m. UTC
While adding simple_dce_worklist to the vectorizer, there was a regression
due to the slp patterns would create a SSA name but never free it even if it
never existed in the IR (this case as addsub but complex ones had the same issue).
The reason why it was never freed was the stmt_vec_info was not marked as a pattern stmt,
unlike the other pattern stmts that use vect_init_pattern_stmt instead of vec_info::add_pattern_stmt
(which is used for SLP patterns).

Bootstrapped and tested on x86_64-linux-gnu.

gcc/ChangeLog:

	* tree-vectorizer.cc (vec_info::add_pattern_stmt): Set pattern_stmt_p.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
---
 gcc/tree-vectorizer.cc | 1 +
 1 file changed, 1 insertion(+)

Comments

Richard Biener Sept. 16, 2024, 6:10 a.m. UTC | #1
> Am 16.09.2024 um 05:12 schrieb Andrew Pinski <quic_apinski@quicinc.com>:
> 
> While adding simple_dce_worklist to the vectorizer, there was a regression
> due to the slp patterns would create a SSA name but never free it even if it
> never existed in the IR (this case as addsub but complex ones had the same issue).
> The reason why it was never freed was the stmt_vec_info was not marked as a pattern stmt,
> unlike the other pattern stmts that use vect_init_pattern_stmt instead of vec_info::add_pattern_stmt
> (which is used for SLP patterns).
> 
> Bootstrapped and tested on x86_64-linux-gnu.

Ok

Richard 

> gcc/ChangeLog:
> 
>    * tree-vectorizer.cc (vec_info::add_pattern_stmt): Set pattern_stmt_p.
> 
> Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
> ---
> gcc/tree-vectorizer.cc | 1 +
> 1 file changed, 1 insertion(+)
> 
> diff --git a/gcc/tree-vectorizer.cc b/gcc/tree-vectorizer.cc
> index 0efabcbb258..4279b6db4cf 100644
> --- a/gcc/tree-vectorizer.cc
> +++ b/gcc/tree-vectorizer.cc
> @@ -535,6 +535,7 @@ stmt_vec_info
> vec_info::add_pattern_stmt (gimple *stmt, stmt_vec_info stmt_info)
> {
>   stmt_vec_info res = new_stmt_vec_info (stmt);
> +  res->pattern_stmt_p = true;
>   set_vinfo_for_stmt (stmt, res, false);
>   STMT_VINFO_RELATED_STMT (res) = stmt_info;
>   return res;
> --
> 2.43.0
>
diff mbox series

Patch

diff --git a/gcc/tree-vectorizer.cc b/gcc/tree-vectorizer.cc
index 0efabcbb258..4279b6db4cf 100644
--- a/gcc/tree-vectorizer.cc
+++ b/gcc/tree-vectorizer.cc
@@ -535,6 +535,7 @@  stmt_vec_info
 vec_info::add_pattern_stmt (gimple *stmt, stmt_vec_info stmt_info)
 {
   stmt_vec_info res = new_stmt_vec_info (stmt);
+  res->pattern_stmt_p = true;
   set_vinfo_for_stmt (stmt, res, false);
   STMT_VINFO_RELATED_STMT (res) = stmt_info;
   return res;