tree-optimization/103190 - fix assert in reassoc stmt placement with asm

Message ID 673rrn12-1577-1350-9844-q5s3nq52s96@fhfr.qr
State Committed
Commit fac4c4bdab1735bd8a87e37c519f0260e4769f2a
Headers
Series tree-optimization/103190 - fix assert in reassoc stmt placement with asm |

Commit Message

Richard Biener Nov. 11, 2021, 3:06 p.m. UTC
  This makes sure to only assert we don't run into a asm goto when
inserting a stmt in reassoc, matching the condition in
can_reassociate_p.  We can handle EH edges from an asm just like
EH edges from any other stmt.

Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed.

2021-11-11  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/103190
	* tree-ssa-reassoc.c (insert_stmt_after): Only assert on asm goto.
---
 gcc/tree-ssa-reassoc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
  

Patch

diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c
index 6a555e7c553..65316223047 100644
--- a/gcc/tree-ssa-reassoc.c
+++ b/gcc/tree-ssa-reassoc.c
@@ -1515,7 +1515,8 @@  insert_stmt_after (gimple *stmt, gimple *insert_point)
       gsi_insert_after (&gsi, stmt, GSI_NEW_STMT);
       return;
     }
-  else if (gimple_code (insert_point) == GIMPLE_ASM)
+  else if (gimple_code (insert_point) == GIMPLE_ASM
+	   && gimple_asm_nlabels (as_a <gasm *> (insert_point)) != 0)
     /* We have no idea where to insert - it depends on where the
        uses will be placed.  */
     gcc_unreachable ();