------- Comment #4 from rguenther at suse dot de 2009-01-16 09:36 ------- Subject: Re: missing FRE with VIEW_CONVERT_EXPR
On Fri, 16 Jan 2009, pinskia at gcc dot gnu dot org wrote: > ------- 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. Can you use the same trick as for union loads/stores and adjust how we record V_C_Es instead and use the needs_insertion stuff? Richard. > 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. */ > > > -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38865