2019-07-05 Richard Biener <rguenther@suse.de>
* tree-ssa-sccvn.c (vn_reference_lookup_3): Valueize RHS
when comparing against a store with possibly the same value.
* gcc.dg/tree-ssa/ssa-fre-77.c: New testcase.
From-SVN: r273136
+2019-07-05 Richard Biener <rguenther@suse.de>
+
+ * tree-ssa-sccvn.c (vn_reference_lookup_3): Valueize RHS
+ when comparing against a store with possibly the same value.
+
2019-07-05 Richard Biener <rguenther@suse.de>
PR tree-optimization/91091
+2019-07-05 Richard Biener <rguenther@suse.de>
+
+ * gcc.dg/tree-ssa/ssa-fre-77.c: New testcase.
+
2019-07-05 Richard Biener <rguenther@suse.de>
PR tree-optimization/91091
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-fre1" } */
+
+int foo (int *p, int *q)
+{
+ int x;
+ *p = 1;
+ x = *p;
+ *q = x;
+ return *p;
+}
+
+/* { dg-final { scan-tree-dump "return 1;" "fre1" } } */
if (res && res != (void *)-1)
{
vn_reference_t vnresult = (vn_reference_t) res;
+ tree rhs = gimple_assign_rhs1 (def_stmt);
+ if (TREE_CODE (rhs) == SSA_NAME)
+ rhs = SSA_VAL (rhs);
if (vnresult->result
- && operand_equal_p (vnresult->result,
- gimple_assign_rhs1 (def_stmt), 0))
+ && operand_equal_p (vnresult->result, rhs, 0))
return res;
}
}