https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82276

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2017-09-21
             Blocks|                            |82244
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot 
gnu.org
            Summary|-O2: ICE: SSA corruption    |[8 Regression] -O2: ICE:
                   |during RTL pass: expand; at |SSA corruption during RTL
                   |tree-ssa-coalesce.c:1010    |pass: expand; at
                   |                            |tree-ssa-coalesce.c:1010
     Ever confirmed|0                           |1

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
Hmpf, I fear the simplest solution will be to cease inserting ASSERT_EXPRs for
abnormals...  With doing those insertions VRP is breaking SSA form by creating
overlapping life ranges.  By forcefully propagating those out it'll succeed
in restoring valid SSA form but with now propagating into asserts themselves
we've made that impossible.

And the propagation happens because when inserting asserts we have

f_27 = ASSERT_EXPR <f_7(ab), ...>
...
f_28(ab) = ASSERT_EXPR <f_27, ...>

so propagating zero into f_27 looks valid.

So what works is ensuring the abnormal flag is sticky during the assert chain:

Index: gcc/tree-vrp.c
===================================================================
--- gcc/tree-vrp.c      (revision 253049)
+++ gcc/tree-vrp.c      (working copy)
@@ -4518,7 +4518,9 @@ build_assert_expr_for (tree cond, tree v
      operand of the ASSERT_EXPR.  Create it so the new name and the old one
      are registered in the replacement table so that we can fix the SSA web
      after adding all the ASSERT_EXPRs.  */
-  create_new_def_for (v, assertion, NULL);
+  tree new_def = create_new_def_for (v, assertion, NULL);
+  if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (v))
+    SSA_NAME_OCCURS_IN_ABNORMAL_PHI (new_def) = 1;

   return assertion;
 }

and the earlier patch should be revertable.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82244
[Bug 82244] [7 Regression] -O2: ICE: tree check: expected ssa_name, have
integer_cst in replace_uses_by, at tree-cfg.c:1904

Reply via email to