diff mbox series

vect: release defs of removed statement

Message ID 20240914072335.59873-1-quic_apinski@quicinc.com
State New
Headers show
Series vect: release defs of removed statement | expand

Commit Message

Andrew Pinski Sept. 14, 2024, 7:23 a.m. UTC
While trying to add use of simple_dce_from_worklist
to the vectorizer so we don't need to run a full blown
DCE pass after the vectorizer, there was a crash noticed
due to a ssa name which has a stmt without a bb. This was
due to not calling release_defs after the call to gsi_remove.

Note the code to remove zero use statements should be able to
remove once the use of simple_dce_from_worklist has been added.
But in the meantime, fixing this bug will also improve memory
usage and a few other things which look through all ssa names.

gcc/ChangeLog:

	* tree-vect-loop.cc (optimize_mask_stores): Call release_defs
	after the call to gsi_remove with last argument of true.

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

Comments

Richard Biener Sept. 15, 2024, 5:27 a.m. UTC | #1
On Sat, Sep 14, 2024 at 9:24 AM Andrew Pinski <quic_apinski@quicinc.com> wrote:
>
> While trying to add use of simple_dce_from_worklist
> to the vectorizer so we don't need to run a full blown
> DCE pass after the vectorizer, there was a crash noticed
> due to a ssa name which has a stmt without a bb. This was
> due to not calling release_defs after the call to gsi_remove.
>
> Note the code to remove zero use statements should be able to
> remove once the use of simple_dce_from_worklist has been added.
> But in the meantime, fixing this bug will also improve memory
> usage and a few other things which look through all ssa names.

OK

> gcc/ChangeLog:
>
>         * tree-vect-loop.cc (optimize_mask_stores): Call release_defs
>         after the call to gsi_remove with last argument of true.
>
> Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
> ---
>  gcc/tree-vect-loop.cc | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc
> index cc15492f6a0..62c7f90779f 100644
> --- a/gcc/tree-vect-loop.cc
> +++ b/gcc/tree-vect-loop.cc
> @@ -12803,6 +12803,7 @@ optimize_mask_stores (class loop *loop)
>                   if (has_zero_uses (lhs))
>                     {
>                       gsi_remove (&gsi_from, true);
> +                     release_defs (stmt1);
>                       continue;
>                     }
>                 }
> --
> 2.43.0
>
diff mbox series

Patch

diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc
index cc15492f6a0..62c7f90779f 100644
--- a/gcc/tree-vect-loop.cc
+++ b/gcc/tree-vect-loop.cc
@@ -12803,6 +12803,7 @@  optimize_mask_stores (class loop *loop)
 		  if (has_zero_uses (lhs))
 		    {
 		      gsi_remove (&gsi_from, true);
+		      release_defs (stmt1);
 		      continue;
 		    }
 		}