Commit 737142ce by Andrew Pinski Committed by Andrew Pinski

re PR tree-optimization/38865 (missing FRE with VIEW_CONVERT_EXPR)

2009-06-12  Andrew Pinski  <andrew_pinski@playstation.sony.com>

        PR tree-opt/38865
        * tree-ssa-sccvn.c (visit_reference_op_load): If vn_reference_lookup
        is returns NULL and OP is a VCE, look through the VCE.



2009-06-12  Andrew Pinski  <andrew_pinski@playstation.sony.com>

        PR tree-opt/38865
        * gcc.dg/tree-ssa/fre-vce-1.c
:

From-SVN: r148437
parent d3a0d55d
2009-06-12 Andrew Pinski <andrew_pinski@playstation.sony.com>
PR tree-opt/38865
* tree-ssa-sccvn.c (visit_reference_op_load): If vn_reference_lookup
is returns NULL and OP is a VCE, look through the VCE.
2009-06-12 Ian Lance Taylor <iant@google.com>
PR bootstrap/40430
......
2009-06-12 Andrew Pinski <andrew_pinski@playstation.sony.com>
PR tree-opt/38865
* gcc.dg/tree-ssa/fre-vce-1.c
2009-06-12 H.J. Lu <hongjiu.lu@intel.com>
PR testsuite/40384
......
/* { dg-options "-O2 -fdump-tree-fre -w" } */
/* { dg-do compile } */
#define vector __attribute__((vector_size(sizeof(int)*4) ))
struct s { vector int i; };
vector float f(struct s *sv)
{
sv->i = (vector int){1, 2, 3, 4};
return (vector float)sv->i;
}
vector float f1(struct s *sv, vector int a)
{
sv->i = a;
return (vector float)sv->i;
}
struct s1 { int i; };
void g(struct s1 *, float);
void a1 (struct s1 sv)
{
sv.i = 1;
g(&sv, *(float*)&sv.i);
}
void a2 (struct s1 sv, int i)
{
sv.i = i;
g(&sv, *(float*)&sv.i);
}
/* { dg-final { scan-tree-dump-times "sv_\[0-9\]\\\(D\\\)->i" 2 "fre" } } */
/* { dg-final { scan-tree-dump-times "sv.i" 2 "fre" } } */
......@@ -1976,6 +1976,12 @@ visit_reference_op_load (tree lhs, tree op, gimple stmt)
bool changed = false;
tree result = vn_reference_lookup (op, gimple_vuse (stmt), true, NULL);
/* If we have a VCE, try looking up its operand as it might be stored in
a different type. */
if (!result && TREE_CODE (op) == VIEW_CONVERT_EXPR)
result = vn_reference_lookup (TREE_OPERAND (op, 0), gimple_vuse (stmt),
true, NULL);
/* We handle type-punning through unions by value-numbering based
on offset and size of the access. Be prepared to handle a
type-mismatch here via creating a VIEW_CONVERT_EXPR. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment