public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/23094] New: store ccp misses an optimization
@ 2005-07-27 15:53 belyshev at depni dot sinp dot msu dot ru
  2005-07-27 15:57 ` [Bug tree-optimization/23094] " pinskia at gcc dot gnu dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: belyshev at depni dot sinp dot msu dot ru @ 2005-07-27 15:53 UTC (permalink / raw)
  To: gcc-bugs

// This function can be optimized to just *p = *q = 1; at tree level:

void foo (int *p, int *q)
{
  *p = 1;
  *q = 1;
  if (*p != 1)
    link_error ();
}

-- 
           Summary: store ccp misses an optimization
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P2
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: belyshev at depni dot sinp dot msu dot ru
                CC: dnovillo at gcc dot gnu dot org,gcc-bugs at gcc dot gnu
                    dot org


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


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

* [Bug tree-optimization/23094] store ccp misses an optimization
  2005-07-27 15:53 [Bug tree-optimization/23094] New: store ccp misses an optimization belyshev at depni dot sinp dot msu dot ru
@ 2005-07-27 15:57 ` pinskia at gcc dot gnu dot org
  2005-07-27 16:05 ` dberlin 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-07-27 15:57 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-07-27 15:56 -------
Confirmed.  A weird case but still should be able to optimizated very easily.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |alias
   Last reconfirmed|0000-00-00 00:00:00         |2005-07-27 15:56:51
               date|                            |


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


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

* [Bug tree-optimization/23094] store ccp misses an optimization
  2005-07-27 15:53 [Bug tree-optimization/23094] New: store ccp misses an optimization belyshev at depni dot sinp dot msu dot ru
  2005-07-27 15:57 ` [Bug tree-optimization/23094] " pinskia at gcc dot gnu dot org
@ 2005-07-27 16:05 ` dberlin at gcc dot gnu dot org
  2005-08-13 10:30 ` steven at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: dberlin at gcc dot gnu dot org @ 2005-07-27 16:05 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From dberlin at gcc dot gnu dot org  2005-07-27 16:04 -------
store CCP returns UNKNOWN_VAL as soon as it sees the TMT, even though the RHS is
completely constant, and even after we set the value of the TMT's to constant.

Even if you change the call to link_error to abort (a noreturn function which
has no v_may_defs),
we don't end up noticing the value is constant, because then we determine that
p_1 has an UNKNOWN_VAL, wihch doesn't actually matter, since the TMT is constant
valued, it doesn't matter that we don't know where exactly the pointer points to.

If the pointer had changed, it would be a new version, or the TMT wouldn't be
constant valued.


I've attached a patch that at least gets the TMT's to constant.


-- 


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


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

* [Bug tree-optimization/23094] store ccp misses an optimization
  2005-07-27 15:53 [Bug tree-optimization/23094] New: store ccp misses an optimization belyshev at depni dot sinp dot msu dot ru
  2005-07-27 15:57 ` [Bug tree-optimization/23094] " pinskia at gcc dot gnu dot org
  2005-07-27 16:05 ` dberlin at gcc dot gnu dot org
@ 2005-08-13 10:30 ` steven at gcc dot gnu dot org
  2005-08-15 14:50 ` dnovillo at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: steven at gcc dot gnu dot org @ 2005-08-13 10:30 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From steven at gcc dot gnu dot org  2005-08-13 10:30 -------
Hmm, can someone explain where in store_ccp we stuff constants 
into the mem_ref field of lattice values?  There are a few places 
where simple_cst_equal is used to compare a constant to mem_ref 
but AFAICT mem_ref is always the lhs of an expression?? 
 
 

-- 


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


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

* [Bug tree-optimization/23094] store ccp misses an optimization
  2005-07-27 15:53 [Bug tree-optimization/23094] New: store ccp misses an optimization belyshev at depni dot sinp dot msu dot ru
                   ` (2 preceding siblings ...)
  2005-08-13 10:30 ` steven at gcc dot gnu dot org
@ 2005-08-15 14:50 ` dnovillo at gcc dot gnu dot org
  2005-08-18 13:55 ` pinskia at gcc dot gnu dot org
  2005-08-18 15:26 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: dnovillo at gcc dot gnu dot org @ 2005-08-15 14:50 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From dnovillo at gcc dot gnu dot org  2005-08-15 14:15 -------
(In reply to comment #4)
> Hmm, can someone explain where in store_ccp we stuff constants 
> into the mem_ref field of lattice values?  There are a few places 
> where simple_cst_equal is used to compare a constant to mem_ref 
> but AFAICT mem_ref is always the lhs of an expression?? 
>  
Yes.  mem_ref holds the actual memory store/load expression (i.e., the
REFERENCE_CLASS_P tree).  The actual constant value is always stored in the
CONST_VAL array.



-- 


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


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

* [Bug tree-optimization/23094] store ccp misses an optimization
  2005-07-27 15:53 [Bug tree-optimization/23094] New: store ccp misses an optimization belyshev at depni dot sinp dot msu dot ru
                   ` (3 preceding siblings ...)
  2005-08-15 14:50 ` dnovillo at gcc dot gnu dot org
@ 2005-08-18 13:55 ` pinskia at gcc dot gnu dot org
  2005-08-18 15:26 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-08-18 13:55 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-08-18 13:51 -------
This was not fixed by the patch for PR 21574.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |WAITING


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


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

* [Bug tree-optimization/23094] store ccp misses an optimization
  2005-07-27 15:53 [Bug tree-optimization/23094] New: store ccp misses an optimization belyshev at depni dot sinp dot msu dot ru
                   ` (4 preceding siblings ...)
  2005-08-18 13:55 ` pinskia at gcc dot gnu dot org
@ 2005-08-18 15:26 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-08-18 15:26 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-08-18 13:55 -------
I don't know how this was changed to waiting.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW
   Last reconfirmed|2005-07-27 15:56:51         |2005-08-18 13:55:13
               date|                            |


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


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

end of thread, other threads:[~2005-08-18 13:55 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-07-27 15:53 [Bug tree-optimization/23094] New: store ccp misses an optimization belyshev at depni dot sinp dot msu dot ru
2005-07-27 15:57 ` [Bug tree-optimization/23094] " pinskia at gcc dot gnu dot org
2005-07-27 16:05 ` dberlin at gcc dot gnu dot org
2005-08-13 10:30 ` steven at gcc dot gnu dot org
2005-08-15 14:50 ` dnovillo at gcc dot gnu dot org
2005-08-18 13:55 ` pinskia at gcc dot gnu dot org
2005-08-18 15:26 ` 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).