diff mbox series

Clear currently_expanding_gimple_stmt properly

Message ID 20220301032624.231501-1-hjl.tools@gmail.com
State New
Headers show
Series Clear currently_expanding_gimple_stmt properly | expand

Commit Message

H.J. Lu March 1, 2022, 3:26 a.m. UTC
commit a5883ba0de68efad36db145e75c86394d8bd44ea
Author: Michael Matz <matz@gcc.gnu.org>
Date:   Tue Nov 24 15:37:32 2009 +0000

introduced currently_expanding_gimple_stmt, which was set and cleared in
expand_gimple_basic_block when expanding gimple statement to RTL.  But it
isn't cleared when expand_gimple_basic_block returns inside the loop.

	PR middle-end/104721
	* cfgexpand.cc (expand_gimple_basic_block): Clear
	currently_expanding_gimple_stmt when returning inside the loop.
---
 gcc/cfgexpand.cc | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

Comments

Richard Biener March 1, 2022, 6:22 a.m. UTC | #1
> Am 01.03.2022 um 04:27 schrieb H.J. Lu via Gcc-patches <gcc-patches@gcc.gnu.org>:
> 
> commit a5883ba0de68efad36db145e75c86394d8bd44ea
> Author: Michael Matz <matz@gcc.gnu.org>
> Date:   Tue Nov 24 15:37:32 2009 +0000
> 
> introduced currently_expanding_gimple_stmt, which was set and cleared in
> expand_gimple_basic_block when expanding gimple statement to RTL.  But it
> isn't cleared when expand_gimple_basic_block returns inside the loop.

Ok 

Richard 


> 
>    PR middle-end/104721
>    * cfgexpand.cc (expand_gimple_basic_block): Clear
>    currently_expanding_gimple_stmt when returning inside the loop.
> ---
> gcc/cfgexpand.cc | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/gcc/cfgexpand.cc b/gcc/cfgexpand.cc
> index d51af2e3084..87536ec7ccd 100644
> --- a/gcc/cfgexpand.cc
> +++ b/gcc/cfgexpand.cc
> @@ -5927,7 +5927,10 @@ expand_gimple_basic_block (basic_block bb, bool disable_tail_calls)
>    {
>      new_bb = expand_gimple_cond (bb, as_a <gcond *> (stmt));
>      if (new_bb)
> -        return new_bb;
> +        {
> +          currently_expanding_gimple_stmt = NULL;
> +          return new_bb;
> +        }
>    }
>       else if (is_gimple_debug (stmt))
>    {
> @@ -6049,7 +6052,10 @@ expand_gimple_basic_block (basic_block bb, bool disable_tail_calls)
>          if (can_fallthru)
>            bb = new_bb;
>          else
> -            return new_bb;
> +            {
> +              currently_expanding_gimple_stmt = NULL;
> +              return new_bb;
> +            }
>        }
>        }
>      else
> -- 
> 2.35.1
>
diff mbox series

Patch

diff --git a/gcc/cfgexpand.cc b/gcc/cfgexpand.cc
index d51af2e3084..87536ec7ccd 100644
--- a/gcc/cfgexpand.cc
+++ b/gcc/cfgexpand.cc
@@ -5927,7 +5927,10 @@  expand_gimple_basic_block (basic_block bb, bool disable_tail_calls)
 	{
 	  new_bb = expand_gimple_cond (bb, as_a <gcond *> (stmt));
 	  if (new_bb)
-	    return new_bb;
+	    {
+	      currently_expanding_gimple_stmt = NULL;
+	      return new_bb;
+	    }
 	}
       else if (is_gimple_debug (stmt))
 	{
@@ -6049,7 +6052,10 @@  expand_gimple_basic_block (basic_block bb, bool disable_tail_calls)
 		  if (can_fallthru)
 		    bb = new_bb;
 		  else
-		    return new_bb;
+		    {
+		      currently_expanding_gimple_stmt = NULL;
+		      return new_bb;
+		    }
 		}
 	    }
 	  else