tree-optimization/105012 - fix ICE from local DSE of if-conversion

Message ID 20220322130509.B4798133B6@imap2.suse-dmz.suse.de
State Committed
Commit 08f263e703c4100fa7b9f08cb26cee6c0bd75e4a
Headers
Series tree-optimization/105012 - fix ICE from local DSE of if-conversion |

Commit Message

Richard Biener March 22, 2022, 1:05 p.m. UTC
  The following guards dse_classify_store with the same condition as
the DSE pass does - availability of a virtual definition.  For
the PR we run into the fortran frontend generating a clobber for
a FUNCTION_DECL lhs which is ignored by the operand scanner and has
no virtual operands assigned.  Apart from fixing the frontend the
following fixes the ICE by adjusting if-conversion.

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

2022-03-22  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/105012
	* tree-if-conv.cc (ifcvt_local_dce): Only call
	dse_classify_store when we have a VDEF.
---
 gcc/tree-if-conv.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Patch

diff --git a/gcc/tree-if-conv.cc b/gcc/tree-if-conv.cc
index 375628e6e9e..7495ed653c0 100644
--- a/gcc/tree-if-conv.cc
+++ b/gcc/tree-if-conv.cc
@@ -3145,7 +3145,7 @@  ifcvt_local_dce (class loop *loop)
       gimple_stmt_iterator gsiprev = gsi;
       gsi_prev (&gsiprev);
       stmt = gsi_stmt (gsi);
-      if (gimple_store_p (stmt))
+      if (gimple_store_p (stmt) && gimple_vdef (stmt))
 	{
 	  tree lhs = gimple_get_lhs (stmt);
 	  ao_ref write;