public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/64084] New: [5 Regression] match-and-simplify prefers complex matches
@ 2014-11-26 15:44 rguenth at gcc dot gnu.org
  2014-11-26 15:44 ` [Bug tree-optimization/64084] " rguenth at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-11-26 15:44 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 64084
           Summary: [5 Regression] match-and-simplify prefers complex
                    matches
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rguenth at gcc dot gnu.org

For

int foo (int x)
{
  int y = 0;
  int z = x + 1;
  return z + y;
}

the first CCP pass ends up producing

  z_3 = x_2(D) + 1;
  _4 = x_2(D) + 1;
  return _4;

because (A + CST) + CST' -> A + (CST + CST') matches before A + 0 -> A.

This is because we build the decision tree depth-first (the idea was to
delay possibly expensive predicate evaluations as much as possible).  I suppose
if we'd build the decision tree breath first we would match the "correct"
one first.

For the testcase FRE of course fixes things up for us.  Similarly we could
drop SSA edge following from the folding done in substitute_and_fold.  But
forwprop would have the same issue (in fact it _did_ have the same issue
in 4.9 if you disable CCP - or rather not, because then nothing propagates
the zero).


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug tree-optimization/64084] [5 Regression] match-and-simplify prefers complex matches
  2014-11-26 15:44 [Bug tree-optimization/64084] New: [5 Regression] match-and-simplify prefers complex matches rguenth at gcc dot gnu.org
@ 2014-11-26 15:44 ` rguenth at gcc dot gnu.org
  2014-11-28  8:58 ` rguenth at gcc dot gnu.org
  2014-11-28  9:01 ` rguenth at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-11-26 15:44 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |5.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug tree-optimization/64084] [5 Regression] match-and-simplify prefers complex matches
  2014-11-26 15:44 [Bug tree-optimization/64084] New: [5 Regression] match-and-simplify prefers complex matches rguenth at gcc dot gnu.org
  2014-11-26 15:44 ` [Bug tree-optimization/64084] " rguenth at gcc dot gnu.org
@ 2014-11-28  8:58 ` rguenth at gcc dot gnu.org
  2014-11-28  9:01 ` rguenth at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-11-28  8:58 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Author: rguenth
Date: Fri Nov 28 08:57:43 2014
New Revision: 218141

URL: https://gcc.gnu.org/viewcvs?rev=218141&root=gcc&view=rev
Log:
2014-11-28  Richard Biener  <rguenther@suse.de>

    PR middle-end/64084
    * genmatch.c (dt_node::gen_kids_1): New function, split out
    from dt_node::gen_kids.
    (decision_tree::cmp_node): DT_TRUE are generally not equal.
    (decision_tree::find_node): Treat DT_TRUE as barrier for
    node CSE on the same level.
    (dt_node::append_node): Do not keep DT_TRUE last.
    (dt_node::gen_kids): Emit code after each DT_TRUE node seen.

    * gcc.dg/tree-ssa/ssa-ccp-34.c: New testcase.
    * gcc.dg/tree-ssa/forwprop-31.c: Likewise.

Added:
    trunk/gcc/testsuite/gcc.dg/tree-ssa/forwprop-31.c
    trunk/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-34.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/genmatch.c
    trunk/gcc/testsuite/ChangeLog


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug tree-optimization/64084] [5 Regression] match-and-simplify prefers complex matches
  2014-11-26 15:44 [Bug tree-optimization/64084] New: [5 Regression] match-and-simplify prefers complex matches rguenth at gcc dot gnu.org
  2014-11-26 15:44 ` [Bug tree-optimization/64084] " rguenth at gcc dot gnu.org
  2014-11-28  8:58 ` rguenth at gcc dot gnu.org
@ 2014-11-28  9:01 ` rguenth at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-11-28  9:01 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-11-28  9:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-26 15:44 [Bug tree-optimization/64084] New: [5 Regression] match-and-simplify prefers complex matches rguenth at gcc dot gnu.org
2014-11-26 15:44 ` [Bug tree-optimization/64084] " rguenth at gcc dot gnu.org
2014-11-28  8:58 ` rguenth at gcc dot gnu.org
2014-11-28  9:01 ` rguenth at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).