This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/52631] [4.6/4.7/4.8 Regression] VN does not use simplified expression for lookup
- From: "pinskia at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 24 Mar 2012 03:21:29 +0000
- Subject: [Bug tree-optimization/52631] [4.6/4.7/4.8 Regression] VN does not use simplified expression for lookup
- Auto-submitted: auto-generated
- References: <bug-52631-4@http.gcc.gnu.org/bugzilla/>
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.