[Bug tree-optimization/78343] [6/7 Regression] Loop is not eliminated

2016-11-25 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78343

--- Comment #4 from Richard Biener  ---
Author: rguenth
Date: Fri Nov 25 10:22:57 2016
New Revision: 242872

URL: https://gcc.gnu.org/viewcvs?rev=242872=gcc=rev
Log:
2016-11-24  Richard Biener  

PR tree-optimization/78343
* passes.def: Add CD-DCE pass after loop splitting.
* tree-ssa-dce.c (find_obviously_necessary_stmts): Move
SCEV init/finalize ...
(perform_tree_ssa_dce): ... here.  Deal with being
executed inside the loop pipeline in aggressive mode.

* gcc.dg/tree-ssa/sccp-2.c: New testcase.
* gcc.dg/autopar/uns-outer-6.c: Adjust.
* gcc.dg/tree-ssa/20030808-1.c: Likewise.
* gcc.dg/tree-ssa/20040305-1.c: Likewise.
* gcc.dg/vect/pr38529.c: Likewise.

Added:
trunk/gcc/testsuite/gcc.dg/tree-ssa/sccp-2.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/passes.def
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gcc.dg/autopar/uns-outer-6.c
trunk/gcc/testsuite/gcc.dg/tree-ssa/20030808-1.c
trunk/gcc/testsuite/gcc.dg/tree-ssa/20040305-1.c
trunk/gcc/testsuite/gcc.dg/vect/pr38529.c
trunk/gcc/tree-ssa-dce.c

[Bug tree-optimization/78343] [6/7 Regression] Loop is not eliminated

2016-11-24 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78343

Richard Biener  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |rguenth at gcc dot 
gnu.org

--- Comment #3 from Richard Biener  ---
Testing a patch.

[Bug tree-optimization/78343] [6/7 Regression] Loop is not eliminated

2016-11-17 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78343

--- Comment #2 from Richard Biener  ---
Previously handled by the loop_depth check I guess.  Note that in

void
record_temporary_equivalences (edge e,
   class const_and_copies *const_and_copies,
   class avail_exprs_stack *avail_exprs_stack)
{
...
  /* Record the simple NAME = VALUE equivalence.  */
  tree rhs = edge_info->rhs;
  record_equality (lhs, rhs, const_and_copies);

  /* We already recorded that LHS = RHS, with canonicalization,
 value chain following, etc.

 We also want to record RHS = LHS, but without any canonicalization
 or value chain following.  */
  if (TREE_CODE (rhs) == SSA_NAME)
const_and_copies->record_const_or_copy_raw (rhs, lhs,
SSA_NAME_VALUE (rhs));

we eventually (as in this case) record the same equality twice given
record_equality performs canonicalization:

Optimizing block #4

1>>> STMT 1 = i_6 le_expr quant_3(D)
1>>> STMT 1 = i_6 ge_expr quant_3(D)
1>>> STMT 1 = i_6 eq_expr quant_3(D)
1>>> STMT 0 = i_6 ne_expr quant_3(D)
0>>> COPY quant_3(D) = i_6
0>>> COPY quant_3(D) = i_6
Optimizing statement sum_2 = quant_3(D) * quant_3(D);
  Replaced 'quant_3(D)' with variable 'i_6'
  Replaced 'quant_3(D)' with variable 'i_6'

in the IL we have a non-canonical compare:

:
# i_11 = PHI 
i_6 = i_11 + 1;
if (i_6 != quant_3(D))

IVOPT transforms

  if (quant_3(D) > i_6)
goto ;

to

  if (i_6 != quant_3(D))
goto ;

(both just as side-notes, not really relevant to this PR).

[Bug tree-optimization/78343] [6/7 Regression] Loop is not eliminated

2016-11-14 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78343

Richard Biener  changed:

   What|Removed |Added

 CC||rguenth at gcc dot gnu.org
   Target Milestone|--- |6.3

--- Comment #1 from Richard Biener  ---
DOM substitutes the equivalency from the exit test, replacing the
after-the-loop use with a DEF from inside the loop ...

That's a pretty bad optimization :/

[Bug tree-optimization/78343] [6/7 Regression] Loop is not eliminated

2016-11-13 Thread trippels at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78343

Markus Trippelsdorf  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2016-11-14
 CC||law at gcc dot gnu.org,
   ||trippels at gcc dot gnu.org
  Known to work||5.4.0
Summary|Loop is not eliminated  |[6/7 Regression] Loop is
   ||not eliminated
 Ever confirmed|0   |1
  Known to fail||6.2.0, 7.0