tree-ssa-sccvn.c (vn_reference_lookup_3): Valueize MEM_REF base.
authorRichard Biener <rguenther@suse.de>
Tue, 24 Sep 2019 10:10:49 +0000 (10:10 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Tue, 24 Sep 2019 10:10:49 +0000 (10:10 +0000)
2019-09-24  Richard Biener  <rguenther@suse.de>

* tree-ssa-sccvn.c (vn_reference_lookup_3): Valueize MEM_REF
base.

* gcc.dg/torture/20190924-1.c: New testcase.

From-SVN: r276092

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/20190924-1.c [new file with mode: 0644]
gcc/tree-ssa-sccvn.c

index 91efa763f01c488c984bf58ebbe4ffac93add33d..bd6f54149991c0965b33d4c99223e0df3dd4d2a0 100644 (file)
@@ -1,3 +1,8 @@
+2019-09-24  Richard Biener  <rguenther@suse.de>
+
+       * tree-ssa-sccvn.c (vn_reference_lookup_3): Valueize MEM_REF
+       base.
+
 2019-09-23  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
 
        * config/arm/t-arm (arm-builtins.o): Add dependency on
index d4ec00efd4be5f36fe8accab46c3354b2802bf96..600901d13d743faf6dec2220ab586b34c1f5af89 100644 (file)
@@ -1,3 +1,7 @@
+2019-09-24  Richard Biener  <rguenther@suse.de>
+
+       * gcc.dg/torture/20190924-1.c: New testcase.
+
 2019-09-23  Maciej W. Rozycki  <macro@wdc.com>
 
        * 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 (file)
index 0000000..13b46ac
--- /dev/null
@@ -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;
+}
index c29e2de61acdf69dbf6af4594d9b8c8569044a52..44b8c67b198c300c7449bac87827db25032c3829 100644 (file)
@@ -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.  */