From: Richard Biener Date: Tue, 24 Sep 2019 10:10:49 +0000 (+0000) Subject: tree-ssa-sccvn.c (vn_reference_lookup_3): Valueize MEM_REF base. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3f9e08f57e1de90de5bc9d2a00815ea38064c733;p=gcc.git tree-ssa-sccvn.c (vn_reference_lookup_3): Valueize MEM_REF base. 2019-09-24 Richard Biener * tree-ssa-sccvn.c (vn_reference_lookup_3): Valueize MEM_REF base. * gcc.dg/torture/20190924-1.c: New testcase. From-SVN: r276092 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 91efa763f01..bd6f5414999 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2019-09-24 Richard Biener + + * tree-ssa-sccvn.c (vn_reference_lookup_3): Valueize MEM_REF + base. + 2019-09-23 Kyrylo Tkachov * config/arm/t-arm (arm-builtins.o): Add dependency on diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d4ec00efd4b..600901d13d7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2019-09-24 Richard Biener + + * gcc.dg/torture/20190924-1.c: New testcase. + 2019-09-23 Maciej W. Rozycki * lib/gnat.exp (gnat_target_compile): Pass the `ada' option to diff --git a/gcc/testsuite/gcc.dg/torture/20190924-1.c b/gcc/testsuite/gcc.dg/torture/20190924-1.c new file mode 100644 index 00000000000..13b46ace1b8 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/20190924-1.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ + +struct acct_gather_energy { + int base_consumed_energy; + int consumed_energy; + int previous_consumed_energy; +}; +static struct acct_gather_energy xcc_energy; +struct acct_gather_energy *new; +int _get_joules_task(int first) +{ + if (!first && new->previous_consumed_energy) + first = 1; + new->base_consumed_energy = new->consumed_energy; + __builtin_memcpy(&xcc_energy, new, sizeof(struct acct_gather_energy)); + return xcc_energy.base_consumed_energy; +} diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c index c29e2de61ac..44b8c67b198 100644 --- a/gcc/tree-ssa-sccvn.c +++ b/gcc/tree-ssa-sccvn.c @@ -2935,8 +2935,9 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, void *data_, else return (void *)-1; } - if (TREE_CODE (rhs) != SSA_NAME - && TREE_CODE (rhs) != ADDR_EXPR) + if (TREE_CODE (rhs) == SSA_NAME) + rhs = SSA_VAL (rhs); + else if (TREE_CODE (rhs) != ADDR_EXPR) return (void *)-1; /* The bases of the destination and the references have to agree. */