+2018-08-31 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/87168
+ * tree-ssa-sccvn.c (SSA_VAL): Add visited output parameter.
+ (rpo_elim::eliminate_avail): When OP was not visited it must
+ be available.
+
2018-08-31 David Malcolm <dmalcolm@redhat.com>
* tree-vrp.c (copy_value_range): Convert param "from" from
+2018-08-31 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/87168
+ * gcc.dg/torture/pr87168.c: New testcase.
+
2018-08-31 Vlad Lazar <vlad.lazar@arm.com>
* gcc.target/aarch64/scalar_intrinsics.c (test_vnegd_s64): New.
--- /dev/null
+/* { dg-do compile } */
+
+int a, b, c, d, e, f, *g;
+
+int main ()
+{
+ unsigned i;
+ while (b)
+ {
+ int j, m;
+L1:
+ f = j;
+L2:
+ if (i && e)
+ {
+ i = f;
+ goto L2;
+ }
+ j = f;
+ if (a)
+ goto L3;
+ for (m = 0; m < 2; m++)
+ if (d)
+ goto L1;
+ goto L2;
+L3:
+ (&j != g) | c;
+ }
+ return 0;
+}
/* Return the SSA value of X. */
inline tree
-SSA_VAL (tree x)
+SSA_VAL (tree x, bool *visited = NULL)
{
vn_ssa_aux_t tem = vn_ssa_aux_hash->find_with_hash (x, SSA_NAME_VERSION (x));
+ if (visited)
+ *visited = tem && tem->visited;
return tem && tem->visited ? tem->valnum : x;
}
tree
rpo_elim::eliminate_avail (basic_block bb, tree op)
{
- tree valnum = SSA_VAL (op);
+ bool visited;
+ tree valnum = SSA_VAL (op, &visited);
+ /* If we didn't visit OP then it must be defined outside of the
+ region we process and also dominate it. So it is available. */
+ if (!visited)
+ return op;
if (TREE_CODE (valnum) == SSA_NAME)
{
if (SSA_NAME_IS_DEFAULT_DEF (valnum))