[Bug tree-optimization/90071] [7/8/9 Regression] internal compiler error: SSA corruption

2019-04-15 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90071

--- Comment #4 from Richard Biener  ---
Author: rguenth
Date: Mon Apr 15 11:59:02 2019
New Revision: 270369

URL: https://gcc.gnu.org/viewcvs?rev=270369&root=gcc&view=rev
Log:
2019-04-15  Richard Biener  

PR tree-optimization/90071
* tree-ssa-reassoc.c (init_range_entry): Do not pick up
abnormal operands from def stmts.

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

Added:
trunk/gcc/testsuite/gcc.dg/torture/pr90071.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-ssa-reassoc.c

[Bug tree-optimization/90071] [7/8/9 Regression] internal compiler error: SSA corruption

2019-04-15 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90071

--- Comment #3 from Richard Biener  ---
Matching expression match.pd:1195, generic-match.c:115
Applying pattern match.pd:1251, generic-match.c:17730
Matching expression match.pd:100, generic-match.c:22
Optimizing range tests e_21(ab) +[, 0] and +[-1, ]
 into (unsigned int) e_21(ab) + 1 <= 1

Index: gcc/tree-ssa-reassoc.c
===
--- gcc/tree-ssa-reassoc.c  (revision 270358)
+++ gcc/tree-ssa-reassoc.c  (working copy)
@@ -2143,7 +2143,8 @@ init_range_entry (struct range_entry *r,
  exp_type = boolean_type_node;
}

-  if (TREE_CODE (arg0) != SSA_NAME)
+  if (TREE_CODE (arg0) != SSA_NAME
+ || SSA_NAME_OCCURS_IN_ABNORMAL_PHI (arg0))
break;
   loc = gimple_location (stmt);
   switch (code)

[Bug tree-optimization/90071] [7/8/9 Regression] internal compiler error: SSA corruption

2019-04-15 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90071

Richard Biener  changed:

   What|Removed |Added

   Priority|P3  |P2
 Status|NEW |ASSIGNED
 CC||rguenth at gcc dot gnu.org
   Assignee|unassigned at gcc dot gnu.org  |rguenth at gcc dot 
gnu.org

--- Comment #2 from Richard Biener  ---
reassoc does this:

@@ -51,9 +75,11 @@
 f:
   _7 = d_20(D) != 0;
   _9 = _4 < 0;
-  _10 = _7 | _9;
+  _18 = (unsigned int) e_21(ab);
+  _16 = _18 + 1;
+  _14 = _16 > 1;
   _17 = _4 > 1;
-  _6 = _10 | _17;
+  _6 = _14 | _7;
   _8 = (int) _6;
   _12 = (long int) _8;
   _13 = (void *) _12;

it's likely folding

  _4 = e.1_3 + 1;
  _9 = _4 < 0;

here.  I'll take a look.