public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix PR tree-optimization/71170
@ 2016-05-19  8:04 Martin Liška
  2016-05-19  8:10 ` Richard Biener
  2016-05-19  8:12 ` Kugan Vivekanandarajah
  0 siblings, 2 replies; 17+ messages in thread
From: Martin Liška @ 2016-05-19  8:04 UTC (permalink / raw)
  To: GCC Patches; +Cc: Kugan Vivekanandarajah

[-- Attachment #1: Type: text/plain, Size: 223 bytes --]

Hello.

Following patch fixes the ICE as it defensively finds the right
place where a new STMT should be inserted.

Patch bootstraps on x86_64-linux-gnu and no new regression is introduced.

Ready for trunk?
Thanks,
Martin

[-- Attachment #2: 0001-Fix-PR-tree-optimization-71170.patch --]
[-- Type: text/x-patch, Size: 2208 bytes --]

From de9f966a20cf08721dc8bdb83144b07f72e6cc59 Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Wed, 18 May 2016 13:21:36 +0200
Subject: [PATCH] Fix PR tree-optimization/71170

gcc/ChangeLog:

2016-05-18  Martin Liska  <mliska@suse.cz>

	* tree-ssa-reassoc.c (rewrite_expr_tree): Insert a new gimple
	stmt if we would use a SSA_NAME before its definition.
---
 gcc/tree-ssa-reassoc.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c
index 3b5f36b..a8fd889 100644
--- a/gcc/tree-ssa-reassoc.c
+++ b/gcc/tree-ssa-reassoc.c
@@ -3813,7 +3813,8 @@ rewrite_expr_tree (gimple *stmt, unsigned int opindex,
 	     some redundant operations, so unless we are just swapping the
 	     arguments or unless there is no change at all (then we just
 	     return lhs), force creation of a new SSA_NAME.  */
-	  if (changed || ((rhs1 != oe2->op || rhs2 != oe1->op) && opindex))
+	  if (changed || ((rhs1 != oe2->op || rhs2 != oe1->op) && opindex)
+	      || find_insert_point (stmt, oe1->op, oe2->op) != stmt)
 	    {
 	      gimple *insert_point
 		= find_insert_point (stmt, oe1->op, oe2->op);
@@ -3830,8 +3831,6 @@ rewrite_expr_tree (gimple *stmt, unsigned int opindex,
 	    }
 	  else
 	    {
-	      gcc_checking_assert (find_insert_point (stmt, oe1->op, oe2->op)
-				   == stmt);
 	      gimple_assign_set_rhs1 (stmt, oe1->op);
 	      gimple_assign_set_rhs2 (stmt, oe2->op);
 	      update_stmt (stmt);
@@ -3876,7 +3875,7 @@ rewrite_expr_tree (gimple *stmt, unsigned int opindex,
 	 Otherwise ensure the old lhs SSA_NAME is not reused and
 	 create a new stmt as well, so that any debug stmts will be
 	 properly adjusted.  */
-      if (changed)
+      if (changed || find_insert_point (stmt, new_rhs1, oe->op) != stmt)
 	{
 	  gimple_stmt_iterator gsi = gsi_for_stmt (stmt);
 	  unsigned int uid = gimple_uid (stmt);
@@ -3894,8 +3893,6 @@ rewrite_expr_tree (gimple *stmt, unsigned int opindex,
 	}
       else
 	{
-	  gcc_checking_assert (find_insert_point (stmt, new_rhs1, oe->op)
-			       == stmt);
 	  gimple_assign_set_rhs1 (stmt, new_rhs1);
 	  gimple_assign_set_rhs2 (stmt, oe->op);
 	  update_stmt (stmt);
-- 
2.8.2


^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2016-05-24  9:11 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-19  8:04 [PATCH] Fix PR tree-optimization/71170 Martin Liška
2016-05-19  8:10 ` Richard Biener
2016-05-19  8:12 ` Kugan Vivekanandarajah
2016-05-19  8:21   ` Richard Biener
2016-05-19  8:27     ` Kugan
2016-05-19  8:56       ` Richard Biener
2016-05-19 12:19         ` Kugan Vivekanandarajah
2016-05-19 13:04           ` Richard Biener
2016-05-19 23:52             ` Kugan Vivekanandarajah
2016-05-20 11:07               ` Richard Biener
2016-05-21  6:08                 ` Kugan Vivekanandarajah
2016-05-23 11:36                   ` Richard Biener
2016-05-24  3:13                     ` Kugan Vivekanandarajah
2016-05-24  8:37                       ` Christophe Lyon
2016-05-24  8:47                         ` Kugan Vivekanandarajah
2016-05-24  9:11                           ` Jakub Jelinek
2016-05-24  9:07                       ` Richard Biener

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).