Fix oversight in tuplification of DOM

Message ID
State New
Headers show

Commit Message

Eric Botcazou June 30, 2011, 7:42 p.m.
> 2011-06-28  Eric Botcazou  <>
> 	* tree-ssa-dom.c (initialize_hash_element): Fix oversight.

As reported under PR tree-optimization/49572, using the type of the LHS like in 
the other cases leads to optimization regressions.  The attached patch changes 
this to use the type of RHS instead in the GIMPLE_SINGLE_RHS case.

Tested on x86_64-suse-linux, pre-approved by Richard in the PR, applied.

2011-06-30  Eric Botcazou  <>

	PR tree-optimization/49572
	* tree-ssa-dom.c (initialize_hash_element) <GIMPLE_SINGLE_RHS>: Use the
	type of the RHS instead of that of the LHS for the expression type.


Index: tree-ssa-dom.c
--- tree-ssa-dom.c	(revision 175621)
+++ tree-ssa-dom.c	(working copy)
@@ -208,13 +208,11 @@  initialize_hash_element (gimple stmt, tr
       enum tree_code subcode = gimple_assign_rhs_code (stmt);
-      expr->type = NULL_TREE;
       switch (get_gimple_rhs_class (subcode))
         case GIMPLE_SINGLE_RHS:
 	  expr->kind = EXPR_SINGLE;
-	  expr->type = TREE_TYPE (gimple_assign_lhs (stmt));
+	  expr->type = TREE_TYPE (gimple_assign_rhs1 (stmt));
 	  expr->ops.single.rhs = gimple_assign_rhs1 (stmt);
         case GIMPLE_UNARY_RHS: