Patchwork Fix oversight in tuplification of DOM

login
register
mail settings
Submitter Eric Botcazou
Date June 30, 2011, 7:42 p.m.
Message ID <201106302142.32816.ebotcazou@adacore.com>
Download mbox | patch
Permalink /patch/102817/
State New
Headers show

Comments

Eric Botcazou - June 30, 2011, 7:42 p.m.
> 2011-06-28  Eric Botcazou  <ebotcazou@adacore.com>
>
> 	* 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  <ebotcazou@adacore.com>

	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.

Patch

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);
 	  break;
         case GIMPLE_UNARY_RHS: