The following fixes PR81083, we shouldn't end up with abnormals as SSA
vals, even as VN hash value.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk 
sofar.

Richard.

2017-06-14  Richard Biener  <rguent...@suse.de>

        PR tree-optimization/81083
        * tree-ssa-sccvn.c (vn_reference_lookup_3): Do not use abnormals
        as values.

        * gcc.dg/torture/pr81083.c: New testcase.

Index: gcc/tree-ssa-sccvn.c
===================================================================
--- gcc/tree-ssa-sccvn.c        (revision 249145)
+++ gcc/tree-ssa-sccvn.c        (working copy)
@@ -2035,7 +2035,9 @@ vn_reference_lookup_3 (ao_ref *ref, tree
          ops[1] = bitsize_int (ref->size);
          ops[2] = bitsize_int (offset - offset2);
          tree val = vn_nary_build_or_lookup (rcode, vr->type, ops);
-         if (val)
+         if (val
+             && (TREE_CODE (val) != SSA_NAME
+                 || ! SSA_NAME_OCCURS_IN_ABNORMAL_PHI (val)))
            {
              vn_reference_t res = vn_reference_lookup_or_insert_for_pieces
                  (vuse, vr->set, vr->type, vr->operands, val);
Index: gcc/testsuite/gcc.dg/torture/pr81083.c
===================================================================
--- gcc/testsuite/gcc.dg/torture/pr81083.c      (nonexistent)
+++ gcc/testsuite/gcc.dg/torture/pr81083.c      (working copy)
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+
+void a(int arg)
+{
+  extern struct { int x; } obj;
+  setjmp();
+  obj.x = arg;
+  arg = arg;
+  if (obj.x)
+    func();
+  if (obj.x)
+    func();
+}

Reply via email to