public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/13962] [tree-ssa] make "fold" use alias information to optimize pointer comparisons
       [not found] <bug-13962-4@http.gcc.gnu.org/bugzilla/>
@ 2014-08-14 17:42 ` glisse at gcc dot gnu.org
  2014-08-15  7:52 ` rguenther at suse dot de
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 13+ messages in thread
From: glisse at gcc dot gnu.org @ 2014-08-14 17:42 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Marc Glisse <glisse at gcc dot gnu.org> ---
While looking at some unrelated issue, I noticed the following:

  _41 = operator new (28);
...
  if (_41 != &_S_empty_rep_storage)

which happens with a simple use of std::string (with some extra inlining).
__builtin_malloc(42)==&var is not optimized either, so it isn't (only) an issue
with operator new.

If the general case is too dangerous, maybe there is at least some subset that
could safely be optimized?


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

* [Bug tree-optimization/13962] [tree-ssa] make "fold" use alias information to optimize pointer comparisons
       [not found] <bug-13962-4@http.gcc.gnu.org/bugzilla/>
  2014-08-14 17:42 ` [Bug tree-optimization/13962] [tree-ssa] make "fold" use alias information to optimize pointer comparisons glisse at gcc dot gnu.org
@ 2014-08-15  7:52 ` rguenther at suse dot de
  2014-08-15  8:39 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 13+ messages in thread
From: rguenther at suse dot de @ 2014-08-15  7:52 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from rguenther at suse dot de <rguenther at suse dot de> ---
On Thu, 14 Aug 2014, glisse at gcc dot gnu.org wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=13962
> 
> --- Comment #7 from Marc Glisse <glisse at gcc dot gnu.org> ---
> While looking at some unrelated issue, I noticed the following:
> 
>   _41 = operator new (28);
> ...
>   if (_41 != &_S_empty_rep_storage)
> 
> which happens with a simple use of std::string (with some extra inlining).
> __builtin_malloc(42)==&var is not optimized either, so it isn't (only) an issue
> with operator new.
> 
> If the general case is too dangerous, maybe there is at least some subset that
> could safely be optimized?

Well, not sure if really "dangerous", but yes, doing pointer against
address-of-decl disambiguation should be easily possible.

I'll try to hack sth together later today.


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

* [Bug tree-optimization/13962] [tree-ssa] make "fold" use alias information to optimize pointer comparisons
       [not found] <bug-13962-4@http.gcc.gnu.org/bugzilla/>
  2014-08-14 17:42 ` [Bug tree-optimization/13962] [tree-ssa] make "fold" use alias information to optimize pointer comparisons glisse at gcc dot gnu.org
  2014-08-15  7:52 ` rguenther at suse dot de
@ 2014-08-15  8:39 ` rguenth at gcc dot gnu.org
  2014-08-15  9:29 ` glisse at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-08-15  8:39 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Richard Biener <rguenth at gcc dot gnu.org> ---
Created attachment 33336
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33336&action=edit
patch

Like this - does it help the particular case?

Note that one issue is that points-to doesn't track NULL-ness reliably
(like may-point to zero if it may point to a weak decl), and we drop
maybe-NULL-ness because we don't use it.  Likewise we don't keep track
of pointers to CONST_DECLs or LABEL_DECLs or FUNCTION_DECLs (we simply
drop them on the floor rather than treating them as "anything").

The patch doesn't bootstrap which means it probably reveals bugs in
points-to.  This is what I meant with "dangerous" ;)


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

* [Bug tree-optimization/13962] [tree-ssa] make "fold" use alias information to optimize pointer comparisons
       [not found] <bug-13962-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2014-08-15  8:39 ` rguenth at gcc dot gnu.org
@ 2014-08-15  9:29 ` glisse at gcc dot gnu.org
  2023-06-05  6:46 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 13+ messages in thread
From: glisse at gcc dot gnu.org @ 2014-08-15  9:29 UTC (permalink / raw)
  To: gcc-bugs

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

Marc Glisse <glisse at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |glisse at gcc dot gnu.org

--- Comment #10 from Marc Glisse <glisse at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #9)
> Created attachment 33336 [details]
> patch
> 
> Like this - does it help the particular case?

_S_empty_rep_storage has DECL_WEAK, so it doesn't help here :-(


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

* [Bug tree-optimization/13962] [tree-ssa] make "fold" use alias information to optimize pointer comparisons
       [not found] <bug-13962-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2014-08-15  9:29 ` glisse at gcc dot gnu.org
@ 2023-06-05  6:46 ` rguenth at gcc dot gnu.org
  2024-05-16 12:44 ` cvs-commit at gcc dot gnu.org
  2024-05-16 12:47 ` rguenth at gcc dot gnu.org
  6 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-06-05  6:46 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |zhongyunde at huawei dot com

--- Comment #15 from Richard Biener <rguenth at gcc dot gnu.org> ---
*** Bug 110103 has been marked as a duplicate of this bug. ***

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

* [Bug tree-optimization/13962] [tree-ssa] make "fold" use alias information to optimize pointer comparisons
       [not found] <bug-13962-4@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2023-06-05  6:46 ` rguenth at gcc dot gnu.org
@ 2024-05-16 12:44 ` cvs-commit at gcc dot gnu.org
  2024-05-16 12:47 ` rguenth at gcc dot gnu.org
  6 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-05-16 12:44 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #16 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:f3e5f4c58591f5dacdd14a65ec47bbe310df02a0

commit r15-580-gf3e5f4c58591f5dacdd14a65ec47bbe310df02a0
Author: Richard Biener <rguenther@suse.de>
Date:   Mon Mar 11 11:17:32 2024 +0100

    tree-optimization/13962 - handle ptr-ptr compares in ptrs_compare_unequal

    Now that we handle pt.null conservatively we can implement the missing
    tracking of constant pool entries (aka STRING_CST) and handle
    ptr-ptr compares using points-to info in ptrs_compare_unequal.

            PR tree-optimization/13962
            PR tree-optimization/96564
            * tree-ssa-alias.h (pt_solution::const_pool): New flag.
            * tree-ssa-alias.cc (ptrs_compare_unequal): Handle pointer-pointer
            compares.
            (dump_points_to_solution): Dump the const_pool flag, fix guard
            of flag dumping.
            * gimple-pretty-print.cc (pp_points_to_solution): Likewise.
            * tree-ssa-structalias.cc (find_what_var_points_to): Set
            the const_pool flag for STRING.
            (pt_solution_ior_into): Handle the const_pool flag.
            (ipa_escaped_pt): Initialize it.

            * gcc.dg/tree-ssa/alias-39.c: New testcase.
            * g++.dg/vect/pr68145.cc: Use -fno-tree-pta to avoid UB
            to manifest in transforms no longer vectorizing this testcase
            for an ICE.

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

* [Bug tree-optimization/13962] [tree-ssa] make "fold" use alias information to optimize pointer comparisons
       [not found] <bug-13962-4@http.gcc.gnu.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2024-05-16 12:44 ` cvs-commit at gcc dot gnu.org
@ 2024-05-16 12:47 ` rguenth at gcc dot gnu.org
  6 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-05-16 12:47 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #17 from Richard Biener <rguenth at gcc dot gnu.org> ---
I'm closing this as fixed now.  The feature is there, improvements can be made
I guess but first get testcases that are not handled (combine with prange info
is one item).

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

* [Bug tree-optimization/13962] [tree-ssa] make "fold" use alias information to optimize pointer comparisons
       [not found] <bug-13962-1008@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2009-02-22 19:09 ` steven at gcc dot gnu dot org
@ 2009-02-22 20:21 ` rguenth at gcc dot gnu dot org
  4 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-02-22 20:21 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from rguenth at gcc dot gnu dot org  2009-02-22 20:20 -------
Easy but dangerous ;)


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |rguenth at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2006-01-13 04:44:24         |2009-02-22 20:20:56
               date|                            |


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


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

* [Bug tree-optimization/13962] [tree-ssa] make "fold" use alias information to optimize pointer comparisons
       [not found] <bug-13962-1008@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2006-12-12  6:01 ` dann at ics dot uci dot edu
@ 2009-02-22 19:09 ` steven at gcc dot gnu dot org
  2009-02-22 20:21 ` rguenth at gcc dot gnu dot org
  4 siblings, 0 replies; 13+ messages in thread
From: steven at gcc dot gnu dot org @ 2009-02-22 19:09 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from steven at gcc dot gnu dot org  2009-02-22 19:09 -------
Richi, this may be easy to fix on the AIB...


-- 


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


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

* [Bug tree-optimization/13962] [tree-ssa] make "fold" use alias information to optimize pointer comparisons
       [not found] <bug-13962-1008@http.gcc.gnu.org/bugzilla/>
  2006-03-10 15:33 ` dnovillo at gcc dot gnu dot org
  2006-12-10 18:18 ` steven at gcc dot gnu dot org
@ 2006-12-12  6:01 ` dann at ics dot uci dot edu
  2009-02-22 19:09 ` steven at gcc dot gnu dot org
  2009-02-22 20:21 ` rguenth at gcc dot gnu dot org
  4 siblings, 0 replies; 13+ messages in thread
From: dann at ics dot uci dot edu @ 2006-12-12  6:01 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from dann at ics dot uci dot edu  2006-12-12 06:01 -------
Subject: Re:  [tree-ssa] make "fold" use alias information to optimize pointer
comparisons

"steven at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> writes:

  > ------- Comment #3 from steven at gcc dot gnu dot org  2006-12-10 18:18
-------
  > Is this fixed?

No, it's not.


-- 


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


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

* [Bug tree-optimization/13962] [tree-ssa] make "fold" use alias information to optimize pointer comparisons
       [not found] <bug-13962-1008@http.gcc.gnu.org/bugzilla/>
  2006-03-10 15:33 ` dnovillo at gcc dot gnu dot org
@ 2006-12-10 18:18 ` steven at gcc dot gnu dot org
  2006-12-12  6:01 ` dann at ics dot uci dot edu
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 13+ messages in thread
From: steven at gcc dot gnu dot org @ 2006-12-10 18:18 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from steven at gcc dot gnu dot org  2006-12-10 18:18 -------
Is this fixed?


-- 


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


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

* [Bug tree-optimization/13962] [tree-ssa] make "fold" use alias information to optimize pointer comparisons
       [not found] <bug-13962-1008@http.gcc.gnu.org/bugzilla/>
@ 2006-03-10 15:33 ` dnovillo at gcc dot gnu dot org
  2006-12-10 18:18 ` steven at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 13+ messages in thread
From: dnovillo at gcc dot gnu dot org @ 2006-03-10 15:33 UTC (permalink / raw)
  To: gcc-bugs



-- 

dnovillo at gcc dot gnu dot org changed:

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


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


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

* [Bug tree-optimization/13962] [tree-ssa] make "fold" use alias information to optimize pointer comparisons
  2004-02-01 18:22 [Bug optimization/13962] New: " dann at godzilla dot ics dot uci dot edu
@ 2004-05-24 15:37 ` pinskia at gcc dot gnu dot org
  0 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-24 15:37 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|3.5.0                       |---


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


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

end of thread, other threads:[~2024-05-16 12:47 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-13962-4@http.gcc.gnu.org/bugzilla/>
2014-08-14 17:42 ` [Bug tree-optimization/13962] [tree-ssa] make "fold" use alias information to optimize pointer comparisons glisse at gcc dot gnu.org
2014-08-15  7:52 ` rguenther at suse dot de
2014-08-15  8:39 ` rguenth at gcc dot gnu.org
2014-08-15  9:29 ` glisse at gcc dot gnu.org
2023-06-05  6:46 ` rguenth at gcc dot gnu.org
2024-05-16 12:44 ` cvs-commit at gcc dot gnu.org
2024-05-16 12:47 ` rguenth at gcc dot gnu.org
     [not found] <bug-13962-1008@http.gcc.gnu.org/bugzilla/>
2006-03-10 15:33 ` dnovillo at gcc dot gnu dot org
2006-12-10 18:18 ` steven at gcc dot gnu dot org
2006-12-12  6:01 ` dann at ics dot uci dot edu
2009-02-22 19:09 ` steven at gcc dot gnu dot org
2009-02-22 20:21 ` rguenth at gcc dot gnu dot org
2004-02-01 18:22 [Bug optimization/13962] New: " dann at godzilla dot ics dot uci dot edu
2004-05-24 15:37 ` [Bug tree-optimization/13962] " 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).