public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/18768] New: Missed ivopts opportunity
@ 2004-12-01 21:18 pthaugen at us dot ibm dot com
2004-12-01 21:22 ` [Bug tree-optimization/18768] " pinskia at gcc dot gnu dot org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: pthaugen at us dot ibm dot com @ 2004-12-01 21:18 UTC (permalink / raw)
To: gcc-bugs
Opening bug report per Zdeneck's request, snippets of email exchange follows:
=========
void f1 (void * coefPtr, double * dd)
{
int i,j;
/* Cast of "coefPtr" results in poor code for this loop (missed strength
reduction). */
for (i = 0; i < 16; i++) {
*(((double *) coefPtr) + i) = +0.0;
}
for (j = 0; j < 16; j++) {
*(dd + j) = +0.0;
}
}
=========
> this seems to be a problem with the cost function:
>
> Cost of strength reduction of the access =
> Cost for incrementing the new induction variable: 8
> Cost for increased register pressure: 4
> Cost for the memory reference: 1
>
> Cost for expressing the access using i =
> Cost for multiplication by 8: 12
> Cost for the memory reference: 1 (addition of the result of
> multiplications takes place in the address).
>
> The result is that it is not worthwhile to perform strength reduction.
> I will try to do something with the code that estimates cost of memory
> references, since it is quite wrong here.
could you please create a bugreport for this? The things are a bit more
complicated than what I expected; there is actually no way how the
target could let ivopts know that DFmode address for (reg + reg) is more
expensive than just reg, in the current state.
--
Summary: Missed ivopts opportunity
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: tree-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: pthaugen at us dot ibm dot com
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: powerpc64-linux
GCC host triplet: powerpc64-linux
GCC target triplet: powerpc64-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18768
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/18768] Missed ivopts opportunity
2004-12-01 21:18 [Bug tree-optimization/18768] New: Missed ivopts opportunity pthaugen at us dot ibm dot com
@ 2004-12-01 21:22 ` pinskia at gcc dot gnu dot org
2004-12-01 21:44 ` rakdver at gcc dot gnu dot org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-12-01 21:22 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-12-01 21:22 -------
Confirmed, I think what is really is happening is not actually due with the cost of [reg +reg] but really
with the additional code of "(double *) coefPtr" which we should really be zero.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Keywords| |missed-optimization
Last reconfirmed|0000-00-00 00:00:00 |2004-12-01 21:22:47
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18768
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/18768] Missed ivopts opportunity
2004-12-01 21:18 [Bug tree-optimization/18768] New: Missed ivopts opportunity pthaugen at us dot ibm dot com
2004-12-01 21:22 ` [Bug tree-optimization/18768] " pinskia at gcc dot gnu dot org
@ 2004-12-01 21:44 ` rakdver at gcc dot gnu dot org
2004-12-02 21:30 ` pthaugen at us dot ibm dot com
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: rakdver at gcc dot gnu dot org @ 2004-12-01 21:44 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From rakdver at gcc dot gnu dot org 2004-12-01 21:44 -------
There is no additional cost counted for "(double *) coefPtr". The reason why
the result with the cast is different is because PRE creates a (dead) phi node
when moving the cast out of the loop. This phi node changes estimate of register
pressure used in ivopts, which leads to divergence -- we do not perform strength
reduction.
Which is a problem in DFmode, since [reg + reg] addressing for DF mode object
requires two extra additions:
[reg1 + reg2] = ... /* lower half */
reg2+=4;
[reg1 + reg2] = ... /* upper half */
reg2-=4;
Whereas with [reg] addressing mode, this would only be
[reg] = ...
[reg + 4] = ...
Of course when we clean up the unused phi nodes created by PRE, the regression
gets hidden (Daniel is working on this). But the unrelying problem -- the fact
that we cannot tell that the [reg + reg] addressing for DF mode is expensive --
remains.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18768
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/18768] Missed ivopts opportunity
2004-12-01 21:18 [Bug tree-optimization/18768] New: Missed ivopts opportunity pthaugen at us dot ibm dot com
2004-12-01 21:22 ` [Bug tree-optimization/18768] " pinskia at gcc dot gnu dot org
2004-12-01 21:44 ` rakdver at gcc dot gnu dot org
@ 2004-12-02 21:30 ` pthaugen at us dot ibm dot com
2004-12-02 21:56 ` pinskia at gcc dot gnu dot org
2005-03-03 3:07 ` pinskia at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: pthaugen at us dot ibm dot com @ 2004-12-02 21:30 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pthaugen at us dot ibm dot com 2004-12-02 21:30 -------
Here's another example of the same thing, minus the cast/double issue. This one
is strength reduced for 3.4 but not for 4.0.
typedef struct {
union {
unsigned int Init[9];
unsigned char Link[37];
} u;
} BitStreamLinkStruct;
void f2(BitStreamLinkStruct *);
void f1 ()
{
int ixBlock;
BitStreamLinkStruct bitStreamLink;
for(ixBlock=0; ixBlock<=7; ixBlock++){
bitStreamLink.u.Init[ixBlock] = 0x1e1e1e1e;
}
f2(&bitStreamLink);
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18768
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/18768] Missed ivopts opportunity
2004-12-01 21:18 [Bug tree-optimization/18768] New: Missed ivopts opportunity pthaugen at us dot ibm dot com
` (2 preceding siblings ...)
2004-12-02 21:30 ` pthaugen at us dot ibm dot com
@ 2004-12-02 21:56 ` pinskia at gcc dot gnu dot org
2005-03-03 3:07 ` pinskia at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-12-02 21:56 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-12-02 21:56 -------
(In reply to comment #3)
> Here's another example of the same thing, minus the cast/double issue. This one
> is strength reduced for 3.4 but not for 4.0.
I filed PR 18800 for that, it has to do with local arrays, it works with global arrays.
Thanks,
Andrew Pinski
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18768
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/18768] Missed ivopts opportunity
2004-12-01 21:18 [Bug tree-optimization/18768] New: Missed ivopts opportunity pthaugen at us dot ibm dot com
` (3 preceding siblings ...)
2004-12-02 21:56 ` pinskia at gcc dot gnu dot org
@ 2005-03-03 3:07 ` pinskia at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-03-03 3:07 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-03-03 03:07 -------
This has no been fixed on the mainline. I think PRE has changed to not to produce these dead phis.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.0.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18768
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2005-03-03 3:07 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-01 21:18 [Bug tree-optimization/18768] New: Missed ivopts opportunity pthaugen at us dot ibm dot com
2004-12-01 21:22 ` [Bug tree-optimization/18768] " pinskia at gcc dot gnu dot org
2004-12-01 21:44 ` rakdver at gcc dot gnu dot org
2004-12-02 21:30 ` pthaugen at us dot ibm dot com
2004-12-02 21:56 ` pinskia at gcc dot gnu dot org
2005-03-03 3:07 ` 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).