public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/19792] New: Missed optimizations due to signedness in the way
@ 2005-02-06 13:21 kazu@cs.umass.edu
  2005-02-06 13:21 ` [Bug tree-optimization/19792] " kazu@cs.umass.edu
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: kazu@cs.umass.edu @ 2005-02-06 13:21 UTC (permalink / raw)
  To: gcc-bugs

Consider:

extern unsigned char size_lookup[257];

int
foo (unsigned int t)
{
  return (size_lookup [(int) t] == size_lookup[t]);
}

int
bar (unsigned int t)
{
  int a = t;
  return a == t;
}

Both functions should return 1, and in fact that's what the RTL optimizers
notice, but the tree optimizers don't.

This is somewhat related to PR 19790.

-- 
           Summary: Missed optimizations due to signedness in the way
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Keywords: missed-optimization, TREE
          Severity: enhancement
          Priority: P2
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: kazu at cs dot umass dot edu
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug tree-optimization/19792] Missed optimizations due to signedness in the way
  2005-02-06 13:21 [Bug tree-optimization/19792] New: Missed optimizations due to signedness in the way kazu@cs.umass.edu
@ 2005-02-06 13:21 ` kazu@cs.umass.edu
  2005-02-06 15:34 ` kazu@cs.umass.edu
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 10+ messages in thread
From: kazu@cs.umass.edu @ 2005-02-06 13:21 UTC (permalink / raw)
  To: gcc-bugs

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |stevenb at suse dot de


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


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

* [Bug tree-optimization/19792] Missed optimizations due to signedness in the way
  2005-02-06 13:21 [Bug tree-optimization/19792] New: Missed optimizations due to signedness in the way kazu@cs.umass.edu
  2005-02-06 13:21 ` [Bug tree-optimization/19792] " kazu@cs.umass.edu
@ 2005-02-06 15:34 ` kazu@cs.umass.edu
  2005-02-06 16:17 ` pinskia@gcc.gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 10+ messages in thread
From: kazu@cs.umass.edu @ 2005-02-06 15:34 UTC (permalink / raw)
  To: gcc-bugs

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
OtherBugsDependingO|                            |19721
              nThis|                            |


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


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

* [Bug tree-optimization/19792] Missed optimizations due to signedness in the way
  2005-02-06 13:21 [Bug tree-optimization/19792] New: Missed optimizations due to signedness in the way kazu@cs.umass.edu
  2005-02-06 13:21 ` [Bug tree-optimization/19792] " kazu@cs.umass.edu
  2005-02-06 15:34 ` kazu@cs.umass.edu
@ 2005-02-06 16:17 ` pinskia@gcc.gnu.org
  2005-02-13 20:56 ` kazu at cs dot umass dot edu
  2005-03-16 14:59 ` kazu at cs dot umass dot edu
  4 siblings, 0 replies; 10+ messages in thread
From: pinskia@gcc.gnu.org @ 2005-02-06 16:17 UTC (permalink / raw)
  To: gcc-bugs

------- Additional Comments From pinskia at gcc dot gnu dot org  2005-02-06 16:17 -------
Confirmed, For bar, my tree combiner fixes the missed optimization.
Not for foo.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
  BugsThisDependsOn|                            |15459
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2005-02-06 16:17:02
               date|                            |


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


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

* [Bug tree-optimization/19792] Missed optimizations due to signedness in the way
  2005-02-06 13:21 [Bug tree-optimization/19792] New: Missed optimizations due to signedness in the way kazu@cs.umass.edu
                   ` (2 preceding siblings ...)
  2005-02-06 16:17 ` pinskia@gcc.gnu.org
@ 2005-02-13 20:56 ` kazu at cs dot umass dot edu
  2005-03-16 14:59 ` kazu at cs dot umass dot edu
  4 siblings, 0 replies; 10+ messages in thread
From: kazu at cs dot umass dot edu @ 2005-02-13 20:56 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From kazu at cs dot umass dot edu  2005-02-13 14:17 -------
The testcase in this PR was reduced from ggc-page.c:ggc_alloc_typed_stat.


-- 


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


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

* [Bug tree-optimization/19792] Missed optimizations due to signedness in the way
  2005-02-06 13:21 [Bug tree-optimization/19792] New: Missed optimizations due to signedness in the way kazu@cs.umass.edu
                   ` (3 preceding siblings ...)
  2005-02-13 20:56 ` kazu at cs dot umass dot edu
@ 2005-03-16 14:59 ` kazu at cs dot umass dot edu
  4 siblings, 0 replies; 10+ messages in thread
From: kazu at cs dot umass dot edu @ 2005-03-16 14:59 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From kazu at cs dot umass dot edu  2005-03-16 14:59 -------
FYI, here is the tailc dump that I get with the current mainline.

;; Function foo (foo)

foo (t)
{
  unsigned char D.1137;
  unsigned int t.1;
  unsigned char D.1135;
  int t.0;
  int D.1133;

<bb 0>:
  t.0_2 = (int) t_1;
  D.1135_4 = size_lookup[t.0_2];
  D.1137_6 = size_lookup[t_1];
  D.1133_7 = D.1135_4 == D.1137_6;
  return D.1133_7;

}



;; Function bar (bar)

bar (t)
{
  int a;
  unsigned int a.2;
  int D.1142;

<bb 0>:
  a_2 = (int) t_1;
  a.2_3 = (unsigned int) a_2;
  D.1142_4 = t_1 == a.2_3;
  return D.1142_4;

}


-- 


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


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

* [Bug tree-optimization/19792] Missed optimizations due to signedness in the way
       [not found] <bug-19792-4@http.gcc.gnu.org/bugzilla/>
@ 2014-10-31  4:02 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2014-10-31  4:02 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=19792
Bug 19792 depends on bug 15459, which changed state.

Bug 15459 Summary: [meta-bug] there should be a tree combiner like the rtl one
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=15459

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


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

* [Bug tree-optimization/19792] Missed optimizations due to signedness in the way
       [not found] <bug-19792-5009@http.gcc.gnu.org/bugzilla/>
  2006-05-04 13:57 ` rguenth at gcc dot gnu dot org
  2006-05-04 15:04 ` rguenth at gcc dot gnu dot org
@ 2006-05-05  9:17 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-05-05  9:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from pinskia at gcc dot gnu dot org  2006-05-05 09:17 -------
the issue for foo might be considered a different harder issue to resolve.  I
think we need to decide what type is the argument for the ARRAY_REF, is it the
type which the ARRAY has for its bounds or some other type?


-- 


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


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

* [Bug tree-optimization/19792] Missed optimizations due to signedness in the way
       [not found] <bug-19792-5009@http.gcc.gnu.org/bugzilla/>
  2006-05-04 13:57 ` rguenth at gcc dot gnu dot org
@ 2006-05-04 15:04 ` rguenth at gcc dot gnu dot org
  2006-05-05  9:17 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-05-04 15:04 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from rguenth at gcc dot gnu dot org  2006-05-04 15:04 -------
bar is now fixed.


;; Function foo (foo)

Analyzing Edge Insertions.
foo (t)
{
<bb 2>:
  return size_lookup[(int) t] == size_lookup[t];

}



;; Function bar (bar)

Analyzing Edge Insertions.
bar (t)
{
<bb 2>:
  return 1;

}


-- 


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


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

* [Bug tree-optimization/19792] Missed optimizations due to signedness in the way
       [not found] <bug-19792-5009@http.gcc.gnu.org/bugzilla/>
@ 2006-05-04 13:57 ` rguenth at gcc dot gnu dot org
  2006-05-04 15:04 ` rguenth at gcc dot gnu dot org
  2006-05-05  9:17 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-05-04 13:57 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from rguenth at gcc dot gnu dot org  2006-05-04 13:57 -------
Subject: Bug 19792

Author: rguenth
Date: Thu May  4 13:56:52 2006
New Revision: 113527

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

        PR tree-optimization/14287
        PR tree-optimization/14844
        PR tree-optimization/19792
        PR tree-optimization/21608
        PR tree-optimization/27090
        * tree-ssa-pre.c (try_combine_conversion): New function.
        (compute_avail): After constructing the value-handle
        expression, use try_combine_conversion to combine NOP_EXPRs
        with previous value-handle expressions and use the result if it
        is available.

        * gcc.dg/tree-ssa/ssa-fre-1.c: New testcase.
        * gcc.dg/tree-ssa/ssa-fre-2.c: Likewise.
        * gcc.dg/tree-ssa/ssa-fre-3.c: Likewise.
        * gcc.dg/tree-ssa/ssa-fre-4.c: Likewise.
        * gcc.dg/tree-ssa/ssa-fre-5.c: Likewise.

Added:
    trunk/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-1.c
    trunk/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-2.c
    trunk/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-3.c
    trunk/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-4.c
    trunk/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-5.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-ssa-pre.c


-- 


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


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

end of thread, other threads:[~2014-10-31  4:01 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-06 13:21 [Bug tree-optimization/19792] New: Missed optimizations due to signedness in the way kazu@cs.umass.edu
2005-02-06 13:21 ` [Bug tree-optimization/19792] " kazu@cs.umass.edu
2005-02-06 15:34 ` kazu@cs.umass.edu
2005-02-06 16:17 ` pinskia@gcc.gnu.org
2005-02-13 20:56 ` kazu at cs dot umass dot edu
2005-03-16 14:59 ` kazu at cs dot umass dot edu
     [not found] <bug-19792-5009@http.gcc.gnu.org/bugzilla/>
2006-05-04 13:57 ` rguenth at gcc dot gnu dot org
2006-05-04 15:04 ` rguenth at gcc dot gnu dot org
2006-05-05  9:17 ` pinskia at gcc dot gnu dot org
     [not found] <bug-19792-4@http.gcc.gnu.org/bugzilla/>
2014-10-31  4:02 ` pinskia 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).