public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix LIM not clearing range-info
@ 2014-12-10 14:18 Richard Biener
  0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2014-12-10 14:18 UTC (permalink / raw)
  To: gcc-patches


While working on PR42108 I noticed that LIM fails to clear range-info
on SSA names whose defining statements it moves, possibly causing
wrong code generation later on.

The following fixes that.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk.

Richard.

2014-12-10  Richard Biener  <rguenther@suse.de>

	 * tree-ssa-loop-im.c
	 (move_computations_dom_walker::before_dom_children): Clear
	 SSA_NAME_RANGE_INFO on moved stmts.

Index: gcc/tree-ssa-loop-im.c
===================================================================
--- gcc/tree-ssa-loop-im.c	(revision 218515)
+++ gcc/tree-ssa-loop-im.c	(working copy)
@@ -1232,6 +1286,11 @@ move_computations_dom_walker::before_dom
 					  COND_EXPR, t, arg0, arg1);
 	  todo_ |= TODO_cleanup_cfg;
 	}
+      if (INTEGRAL_TYPE_P (TREE_TYPE (gimple_assign_lhs (new_stmt)))
+	  && (!ALWAYS_EXECUTED_IN (bb)
+	      || (ALWAYS_EXECUTED_IN (bb) != level
+		  && !flow_loop_nested_p (ALWAYS_EXECUTED_IN (bb), level))))
+	SSA_NAME_RANGE_INFO (gimple_assign_lhs (new_stmt)) = NULL;
       gsi_insert_on_edge (loop_preheader_edge (level), new_stmt);
       remove_phi_node (&bsi, false);
     }
@@ -1291,6 +1350,13 @@ move_computations_dom_walker::before_dom
 	    }
 	}
       gsi_remove (&bsi, false);
+      if (gimple_has_lhs (stmt)
+	  && TREE_CODE (gimple_get_lhs (stmt)) == SSA_NAME
+	  && INTEGRAL_TYPE_P (TREE_TYPE (gimple_get_lhs (stmt)))
+	  && (!ALWAYS_EXECUTED_IN (bb)
+	      || !(ALWAYS_EXECUTED_IN (bb) == level
+		   || flow_loop_nested_p (ALWAYS_EXECUTED_IN (bb), level))))
+	SSA_NAME_RANGE_INFO (gimple_get_lhs (stmt)) = NULL;
       /* In case this is a stmt that is not unconditionally executed
          when the target loop header is executed and the stmt may
 	 invoke undefined integer or pointer overflow rewrite it to

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-12-10 14:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-10 14:18 [PATCH] Fix LIM not clearing range-info 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).