public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/30978]  New: Does not propagate comparison results
@ 2007-02-27 10:53 rguenth at gcc dot gnu dot org
  2007-02-27 16:15 ` [Bug tree-optimization/30978] " rguenth at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2007-02-27 10:53 UTC (permalink / raw)
  To: gcc-bugs

int foo(int a)
{
  unsigned int b = a > 0;
  char c = b;
  return c;
}

is not optimized to

int foo(int a)
{
  return a > 0;
}

at the tree level.  Forwprop has code to do this if the final propagation
result is in a COND_EXPR.

I have a patch.


-- 
           Summary: Does not propagate comparison results
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: missed-optimization, TREE
          Severity: enhancement
          Priority: P3
         Component: tree-optimization
        AssignedTo: rguenth at gcc dot gnu dot org
        ReportedBy: rguenth at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30978


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

* [Bug tree-optimization/30978] Does not propagate comparison results
  2007-02-27 10:53 [Bug tree-optimization/30978] New: Does not propagate comparison results rguenth at gcc dot gnu dot org
@ 2007-02-27 16:15 ` rguenth at gcc dot gnu dot org
  2007-04-27 13:44 ` rguenth at gcc dot gnu dot org
  2007-04-27 14:06 ` rguenth at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2007-02-27 16:15 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from rguenth at gcc dot gnu dot org  2007-02-27 16:15 -------
Patch posted.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                URL|                            |http://gcc.gnu.org/ml/gcc-
                   |                            |patches/2007-
                   |                            |02/msg02123.html


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30978


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

* [Bug tree-optimization/30978] Does not propagate comparison results
  2007-02-27 10:53 [Bug tree-optimization/30978] New: Does not propagate comparison results rguenth at gcc dot gnu dot org
  2007-02-27 16:15 ` [Bug tree-optimization/30978] " rguenth at gcc dot gnu dot org
@ 2007-04-27 13:44 ` rguenth at gcc dot gnu dot org
  2007-04-27 14:06 ` rguenth at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2007-04-27 13:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from rguenth at gcc dot gnu dot org  2007-04-27 14:44 -------
Subject: Bug 30978

Author: rguenth
Date: Fri Apr 27 14:43:42 2007
New Revision: 124217

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=124217
Log:
2007-04-27  Richard Guenther  <rguenther@suse.de>

        PR tree-optimization/30965
        PR tree-optimization/30978
        * Makefile.in (tree-ssa-forwprop.o): Depend on $(FLAGS_H).
        * tree-ssa-forwprop.c (forward_propagate_into_cond_1): Remove.
        (find_equivalent_equality_comparison): Likewise.
        (simplify_cond): Likewise.
        (get_prop_source_stmt): New helper.
        (get_prop_dest_stmt): Likewise.
        (can_propagate_from): Likewise.
        (remove_prop_source_from_use): Likewise.
        (combine_cond_expr_cond): Likewise.
        (forward_propagate_comparison): New function.
        (forward_propagate_into_cond): Rewrite to use fold for
        tree combining.
        (tree_ssa_forward_propagate_single_use_vars): Call
        forward_propagate_comparison to propagate comparisons.

        * gcc.dg/tree-ssa/pr30978.c: New testcase.
        * gcc.dg/tree-ssa/bool-3.c: Remove XFAIL, explain why.
        * gcc.dg/tree-ssa/ssa-fre-4.c: Use char instead of bool
        * gcc.dg/strict-overflow-5.c: Adjust tree dump scanning.

Added:
    trunk/gcc/testsuite/gcc.dg/tree-ssa/pr30978.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/Makefile.in
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gcc.dg/strict-overflow-5.c
    trunk/gcc/testsuite/gcc.dg/tree-ssa/bool-3.c
    trunk/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-4.c
    trunk/gcc/tree-ssa-forwprop.c


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30978


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

* [Bug tree-optimization/30978] Does not propagate comparison results
  2007-02-27 10:53 [Bug tree-optimization/30978] New: Does not propagate comparison results rguenth at gcc dot gnu dot org
  2007-02-27 16:15 ` [Bug tree-optimization/30978] " rguenth at gcc dot gnu dot org
  2007-04-27 13:44 ` rguenth at gcc dot gnu dot org
@ 2007-04-27 14:06 ` rguenth at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2007-04-27 14:06 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from rguenth at gcc dot gnu dot org  2007-04-27 15:06 -------
Fixed.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.3.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30978


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

end of thread, other threads:[~2007-04-27 14:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-27 10:53 [Bug tree-optimization/30978] New: Does not propagate comparison results rguenth at gcc dot gnu dot org
2007-02-27 16:15 ` [Bug tree-optimization/30978] " rguenth at gcc dot gnu dot org
2007-04-27 13:44 ` rguenth at gcc dot gnu dot org
2007-04-27 14:06 ` rguenth at gcc dot gnu dot 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).