From b38f4c1b7670ca537e500ded32edaa7b2ea7f971 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Thu, 27 Jun 2019 10:11:57 +0000 Subject: [PATCH] tree-ssa-sccvn.c (vn_reference_lookup_3): Encode valueized RHS. 2019-06-27 Richard Biener * tree-ssa-sccvn.c (vn_reference_lookup_3): Encode valueized RHS. * gcc.dg/tree-ssa/ssa-fre-69.c: New testcase. From-SVN: r272742 --- gcc/ChangeLog | 4 +++ gcc/testsuite/ChangeLog | 4 +++ gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-69.c | 32 ++++++++++++++++++++++ gcc/tree-ssa-sccvn.c | 2 +- 4 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-69.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 44f9850b671..0561f1091f2 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2019-06-27 Richard Biener + + * tree-ssa-sccvn.c (vn_reference_lookup_3): Encode valueized RHS. + 2019-06-27 Jun Ma PR tree-optimization/89772 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3c459a406d2..388fd2b5573 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2019-06-27 Richard Biener + + * gcc.dg/tree-ssa/ssa-fre-69.c: New testcase. + 2019-06-27 Jun Ma PR tree-optimization/89772 diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-69.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-69.c new file mode 100644 index 00000000000..e2ce28ecc87 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-69.c @@ -0,0 +1,32 @@ +/* { dg-do compile } */ +/* { dg-options "-fgimple -O1 -fdump-tree-fre1" } */ + +int a[10]; +typedef int v2si __attribute__((vector_size(__SIZEOF_INT__*2))); +int __GIMPLE (ssa,guessed_local(97603132),startwith("fre1")) + foo () +{ + int i; + int _59; + int _44; + int _13; + int _18; + v2si _80; + v2si _81; + int res; + + __BB(2,guessed_local(97603132)): + _59 = 64; + i_61 = 9; + _44 = i_61 * i_61; + _80 = _Literal (v2si) {_59, _44}; + _81 = _80; + __MEM ((int *)&a + _Literal (int *) 32) = _81; + i_48 = 9; + _13 = a[8]; + _18 = a[i_48]; + res_15 = _13 + _18; + return res_15; +} + +/* { dg-final { scan-tree-dump "return 145;" "fre1" } } */ diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c index b4f626000dd..9c74be074d2 100644 --- a/gcc/tree-ssa-sccvn.c +++ b/gcc/tree-ssa-sccvn.c @@ -2242,7 +2242,7 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, void *vr_, tree rhs = gimple_assign_rhs1 (def_stmt); if (TREE_CODE (rhs) == SSA_NAME) rhs = SSA_VAL (rhs); - len = native_encode_expr (gimple_assign_rhs1 (def_stmt), + len = native_encode_expr (rhs, buffer, sizeof (buffer), (offseti - offset2) / BITS_PER_UNIT); if (len > 0 && len * BITS_PER_UNIT >= maxsizei) -- 2.30.2