public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/25485]  New: VRP misses an "if" statement that could be optimized away
@ 2005-12-18 19:06 kazu at gcc dot gnu dot org
  2005-12-18 19:18 ` [Bug tree-optimization/25485] VRP misses an "if" with TRUTH_AND_EXPR " pinskia at gcc dot gnu dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: kazu at gcc dot gnu dot org @ 2005-12-18 19:06 UTC (permalink / raw)
  To: gcc-bugs

Consider:

int
foo (int a, int b)
{
  if (a > 50)
    return 19;
  if (a > 63 && b < 50)
    return 17;
  return 31;
}

VRP does not optimize away the second "if" statement.

Here is the output from VRP.

foo (a, b)
{
  _Bool D.1662;
  _Bool D.1661;
  _Bool D.1660;
  int D.1659;

<bb 2>:
  if (a_2 > 50) goto <L4>; else goto <L1>;

<L1>:;
  D.1660_4 = 0;
  D.1661_6 = b_5 <= 49;
  D.1662_7 = 0;
  if (D.1662_7) goto <L2>; else goto <L4>;

<L2>:;

  # D.1659_1 = PHI <19(2), 17(4), 31(3)>;
<L4>:;
  return D.1659_1;

}


-- 
           Summary: VRP misses an "if" statement that could be optimized
                    away
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: kazu at gcc dot gnu dot org
GCC target triplet: x86_64-pc-linux-gnu


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


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

* [Bug tree-optimization/25485] VRP misses an "if" with TRUTH_AND_EXPR statement that could be optimized away
  2005-12-18 19:06 [Bug tree-optimization/25485] New: VRP misses an "if" statement that could be optimized away kazu at gcc dot gnu dot org
@ 2005-12-18 19:18 ` pinskia at gcc dot gnu dot org
  2005-12-18 19:19 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-12-18 19:18 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2005-12-18 19:18 -------
Confirmed, the problem is that VRP folds a > 63 and then props that into temp
&& temp1 but does not prop after that.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2005-12-18 19:18:37
               date|                            |
            Summary|VRP misses an "if" statement|VRP misses an "if" with
                   |that could be optimized away|TRUTH_AND_EXPR statement
                   |                            |that could be optimized away


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


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

* [Bug tree-optimization/25485] VRP misses an "if" with TRUTH_AND_EXPR statement that could be optimized away
  2005-12-18 19:06 [Bug tree-optimization/25485] New: VRP misses an "if" statement that could be optimized away kazu at gcc dot gnu dot org
  2005-12-18 19:18 ` [Bug tree-optimization/25485] VRP misses an "if" with TRUTH_AND_EXPR " pinskia at gcc dot gnu dot org
@ 2005-12-18 19:19 ` pinskia at gcc dot gnu dot org
  2005-12-19  0:01 ` kazu at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-12-18 19:19 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2005-12-18 19:19 -------
I should note that this only happens for targets whos BRANCH_COST is semi high.


-- 


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


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

* [Bug tree-optimization/25485] VRP misses an "if" with TRUTH_AND_EXPR statement that could be optimized away
  2005-12-18 19:06 [Bug tree-optimization/25485] New: VRP misses an "if" statement that could be optimized away kazu at gcc dot gnu dot org
  2005-12-18 19:18 ` [Bug tree-optimization/25485] VRP misses an "if" with TRUTH_AND_EXPR " pinskia at gcc dot gnu dot org
  2005-12-18 19:19 ` pinskia at gcc dot gnu dot org
@ 2005-12-19  0:01 ` kazu at gcc dot gnu dot org
  2006-01-14 15:42 ` kazu at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: kazu at gcc dot gnu dot org @ 2005-12-19  0:01 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from kazu at gcc dot gnu dot org  2005-12-19 00:01 -------
I've got a preliminary patch.


-- 

kazu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |kazu at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED


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


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

* [Bug tree-optimization/25485] VRP misses an "if" with TRUTH_AND_EXPR statement that could be optimized away
  2005-12-18 19:06 [Bug tree-optimization/25485] New: VRP misses an "if" statement that could be optimized away kazu at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2005-12-19  0:01 ` kazu at gcc dot gnu dot org
@ 2006-01-14 15:42 ` kazu at gcc dot gnu dot org
  2006-01-14 15:48 ` kazu at gcc dot gnu dot org
  2006-01-23 16:32 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: kazu at gcc dot gnu dot org @ 2006-01-14 15:42 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from kazu at gcc dot gnu dot org  2006-01-14 15:42 -------
Subject: Bug 25485

Author: kazu
Date: Sat Jan 14 15:42:11 2006
New Revision: 109704

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=109704
Log:
gcc/
        PR tree-optimization/25485
        * tree-vrp.c (extract_range_from_binary_expr): Handle cases
        where one of the operands of TRUTH_AND_EXPR and TRUTH_OR_EXPR
        is known to be false and true, respectively.

gcc/testsuite/
        PR tree-optimization/25485
        * gcc.dg/tree-ssa/pr25485.c: New.

Added:
    trunk/gcc/testsuite/gcc.dg/tree-ssa/pr25485.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-vrp.c


-- 


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


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

* [Bug tree-optimization/25485] VRP misses an "if" with TRUTH_AND_EXPR statement that could be optimized away
  2005-12-18 19:06 [Bug tree-optimization/25485] New: VRP misses an "if" statement that could be optimized away kazu at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2006-01-14 15:42 ` kazu at gcc dot gnu dot org
@ 2006-01-14 15:48 ` kazu at gcc dot gnu dot org
  2006-01-23 16:32 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: kazu at gcc dot gnu dot org @ 2006-01-14 15:48 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from kazu at gcc dot gnu dot org  2006-01-14 15:48 -------
Just checked in a patch.


-- 

kazu at gcc dot gnu dot org changed:

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


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


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

* [Bug tree-optimization/25485] VRP misses an "if" with TRUTH_AND_EXPR statement that could be optimized away
  2005-12-18 19:06 [Bug tree-optimization/25485] New: VRP misses an "if" statement that could be optimized away kazu at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2006-01-14 15:48 ` kazu at gcc dot gnu dot org
@ 2006-01-23 16:32 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-01-23 16:32 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.2.0


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


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

end of thread, other threads:[~2006-01-23 16:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-12-18 19:06 [Bug tree-optimization/25485] New: VRP misses an "if" statement that could be optimized away kazu at gcc dot gnu dot org
2005-12-18 19:18 ` [Bug tree-optimization/25485] VRP misses an "if" with TRUTH_AND_EXPR " pinskia at gcc dot gnu dot org
2005-12-18 19:19 ` pinskia at gcc dot gnu dot org
2005-12-19  0:01 ` kazu at gcc dot gnu dot org
2006-01-14 15:42 ` kazu at gcc dot gnu dot org
2006-01-14 15:48 ` kazu at gcc dot gnu dot org
2006-01-23 16:32 ` pinskia 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).