public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/19703] New: Poor optimisation of loop test
@ 2005-01-30 2:59 andrewhutchinson at cox dot net
2005-01-30 5:25 ` [Bug tree-optimization/19703] [4.0 Regression] Poor optimisation of loop test, DOM causing unsigned to int and missing combine compares pinskia at gcc dot gnu dot org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: andrewhutchinson at cox dot net @ 2005-01-30 2:59 UTC (permalink / raw)
To: gcc-bugs
Missed optimization
gcc version 4.0.0 20041205 (experimental)
4.0.0/cc1.exe -quiet -v looprv.c -quiet -dumpbase
looprv.c -mmcu=atmega169 -auxbase looprv -Os -Wall -version -funsigned-char
-funsigned-bitfields -fpack-struct -fshort-enums -o looprv.s
Down counting loop, uses expensive compare EQ (-n) instead of compare >=0.
Testcase as follows:
volatile char value6;
extern void foo6(char);
void testloop6(void)
{
int i;
for (i=100;i>= 0;i-=10)
{
if (!value6)
{
foo6(i);
}
}
Loop test in RTL is compare NE -10. It should be compare GE 0 - which
is(generally) free. First dump of Expanded RTL show the compare.
--
Summary: Poor optimisation of loop test
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Severity: minor
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: andrewhutchinson at cox dot net
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19703
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/19703] [4.0 Regression] Poor optimisation of loop test, DOM causing unsigned to int and missing combine compares
2005-01-30 2:59 [Bug c/19703] New: Poor optimisation of loop test andrewhutchinson at cox dot net
@ 2005-01-30 5:25 ` pinskia at gcc dot gnu dot org
2005-01-30 19:20 ` pinskia 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 @ 2005-01-30 5:25 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-01-30 05:25 -------
Confirmed (sorry about that I was thinking of something different at the time).
Here is a better example for normal targets (PPC and x86 too):
extern void foo6(int);
void testloop6 (void)
{
int i;
i = 100;
do {
foo6 ( i);
i-=10;
} while (i != 0);
}
The tree dump for the loop on x86:
<L0>:;
foo6 (i);
D.1592 = (unsigned int) i + 0fffffff6;
i = (int) D.1592;
if (D.1592 != 0) goto <L0>; else goto <L1>;
Note this is not IV-OPTS messing up but DOM changing the if statement.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
GCC target triplet|avr |
Last reconfirmed|0000-00-00 00:00:00 |2005-01-30 05:25:46
date| |
Summary|Poor optimisation of loop |[4.0 Regression] Poor
|test |optimisation of loop test,
| |DOM causing unsigned to int
| |and missing combine compares
Target Milestone|--- |4.0.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19703
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/19703] [4.0 Regression] Poor optimisation of loop test, DOM causing unsigned to int and missing combine compares
2005-01-30 2:59 [Bug c/19703] New: Poor optimisation of loop test andrewhutchinson at cox dot net
2005-01-30 5:25 ` [Bug tree-optimization/19703] [4.0 Regression] Poor optimisation of loop test, DOM causing unsigned to int and missing combine compares pinskia at gcc dot gnu dot org
@ 2005-01-30 19:20 ` pinskia at gcc dot gnu dot org
2005-02-10 23:46 ` pinskia at gcc dot gnu dot org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-01-30 19:20 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-01-30 19:20 -------
Even though DOM is the problem, IV-OPTS can be improved so we don't create the casts in the first
place, patch here to do that: <http://gcc.gnu.org/ml/gcc-patches/2005-01/msg02209.html>.
I will try get a testcase where DOM messes up even without IV-OPTs doing anything.
And here is that testcase, yes it is werid for someone to do this but ...:
extern void foo6(int);
void testloop6 (void)
{
unsigned int D1133;
int i;
i = 100;
do {
foo6 (i);
i = ((unsigned int) i) + 4294967286U;
}while (i != 0);
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19703
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/19703] [4.0 Regression] Poor optimisation of loop test, DOM causing unsigned to int and missing combine compares
2005-01-30 2:59 [Bug c/19703] New: Poor optimisation of loop test andrewhutchinson at cox dot net
2005-01-30 5:25 ` [Bug tree-optimization/19703] [4.0 Regression] Poor optimisation of loop test, DOM causing unsigned to int and missing combine compares pinskia at gcc dot gnu dot org
2005-01-30 19:20 ` pinskia at gcc dot gnu dot org
@ 2005-02-10 23:46 ` pinskia at gcc dot gnu dot org
2005-08-17 12:43 ` pinskia at gcc dot gnu dot org
2005-09-27 16:12 ` mmitchel at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-02-10 23:46 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-02-10 21:04 -------
Lowering the priority as IV-OPTs has worked around DOM's problems.
--
What |Removed |Added
----------------------------------------------------------------------------
Priority|P2 |P3
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19703
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/19703] [4.0 Regression] Poor optimisation of loop test, DOM causing unsigned to int and missing combine compares
2005-01-30 2:59 [Bug c/19703] New: Poor optimisation of loop test andrewhutchinson at cox dot net
` (2 preceding siblings ...)
2005-02-10 23:46 ` pinskia at gcc dot gnu dot org
@ 2005-08-17 12:43 ` pinskia at gcc dot gnu dot org
2005-09-27 16:12 ` mmitchel at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-08-17 12:43 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-08-17 12:37 -------
This has been fixed on the mainline now.
--
What |Removed |Added
----------------------------------------------------------------------------
Known to fail| |4.0.0
Known to work| |3.4.0 4.1.0
Summary|[4.0/4.1 Regression] Poor |[4.0 Regression] Poor
|optimisation of loop test, |optimisation of loop test,
|DOM causing unsigned to int |DOM causing unsigned to int
|and missing combine compares|and missing combine compares
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19703
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/19703] [4.0 Regression] Poor optimisation of loop test, DOM causing unsigned to int and missing combine compares
2005-01-30 2:59 [Bug c/19703] New: Poor optimisation of loop test andrewhutchinson at cox dot net
` (3 preceding siblings ...)
2005-08-17 12:43 ` pinskia at gcc dot gnu dot org
@ 2005-09-27 16:12 ` mmitchel at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-09-27 16:12 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|4.0.2 |4.0.3
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19703
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2005-11-04 15:36 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <bug-19703-7648@http.gcc.gnu.org/bugzilla/>
2005-11-04 15:36 ` [Bug tree-optimization/19703] [4.0 Regression] Poor optimisation of loop test, DOM causing unsigned to int and missing combine compares pinskia at gcc dot gnu dot org
2005-01-30 2:59 [Bug c/19703] New: Poor optimisation of loop test andrewhutchinson at cox dot net
2005-01-30 5:25 ` [Bug tree-optimization/19703] [4.0 Regression] Poor optimisation of loop test, DOM causing unsigned to int and missing combine compares pinskia at gcc dot gnu dot org
2005-01-30 19:20 ` pinskia at gcc dot gnu dot org
2005-02-10 23:46 ` pinskia at gcc dot gnu dot org
2005-08-17 12:43 ` pinskia at gcc dot gnu dot org
2005-09-27 16:12 ` mmitchel 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).