http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52631

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-03-24 
03:21:29 UTC ---
Here is the simpler patch:
Index: tree-ssa-sccvn.c
===================================================================
--- tree-ssa-sccvn.c    (revision 185559)
+++ tree-ssa-sccvn.c    (working copy)
@@ -3295,6 +3295,17 @@ visit_use (tree use)
                }
              else
                {
+                 /* First try to lookup the simplified expression. */
+                 if (simplified && valid_gimple_rhs_p (simplified))
+                   {
+                     tree result = vn_nary_op_lookup (simplified, NULL);
+                     if (result)
+                       {
+                         changed = set_ssa_val_to (lhs, result);
+                         goto done;
+                       }
+                   }
+                 /* Otherwise visit the original statement. */
                  switch (get_gimple_rhs_class (code))
                    {
                    case GIMPLE_UNARY_RHS:
---- CUT -----

ChangeLog:
* tree-ssa-sccvn.c (visit_use): Before looking up the original statement, try
looking up the simplified expression.

Reply via email to