------- Comment #2 from pinskia at gcc dot gnu dot org 2009-01-16 02:33 -------
Mine. Simple patch which implements it in vn_reference_lookup, Since VCE is
both a reference and really a bit-wise cast, we can do the normal lookup and
then do a lookup if the VCE was not there. I have not seen if this improves
any testcases yet though but I thought I remembering seeing code like this in
the benchmark we have internally.
Index: tree-ssa-sccvn.c
===================================================================
--- tree-ssa-sccvn.c (revision 143413)
+++ tree-ssa-sccvn.c (working copy)
@@ -1041,6 +1041,19 @@ vn_reference_lookup (tree op, VEC (tree,
vr1.operands = valueize_refs (shared_reference_ops_from_ref (op));
vr1.hashcode = vn_reference_compute_hash (&vr1);
result = vn_reference_lookup_1 (&vr1, vnresult);
+
+ /* If we don't get the result right away for a VIEW_CONVERT_EXPR, try again
+ with the original expression. */
+ if (!result && TREE_CODE (op) == VIEW_CONVERT_EXPR)
+ {
+ vr1.vuses = valueize_vuses (vuses);
+ vr1.operands = valueize_refs (shared_reference_ops_from_ref
(TREE_OPERAND (op, 0)));
+ vr1.hashcode = vn_reference_compute_hash (&vr1);
+ result = vn_reference_lookup_1 (&vr1, vnresult);
+ /* Convert it back to the original type */
+ if (result)
+ fold_build1 (VIEW_CONVERT_EXPR, TREE_TYPE (op), result);
+ }
/* If there is a single defining statement for all virtual uses, we can
use that, following virtual use-def chains. */
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |pinskia at gcc dot gnu dot
|dot org |org
Status|UNCONFIRMED |ASSIGNED
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2009-01-16 02:33:46
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38865