public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug other/17100] New: Missed opportunity for value range optimization
@ 2004-08-19 14:59 gcc-bugzilla at gcc dot gnu dot org
2004-08-19 15:03 ` [Bug tree-optimization/17100] " pinskia at gcc dot gnu dot org
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: gcc-bugzilla at gcc dot gnu dot org @ 2004-08-19 14:59 UTC (permalink / raw)
To: gcc-bugs
Description:
A non-optimal code sequence is illustraded. Duplicate using gcc 3.5 and
command line:
gcc -O3 -m64 -c test.c
Testcase:
int x;
int a[10];
void bar () {
printf("bar\n");
}
void foo ()
{
int i;
int j;
j = x;
for (i = 0; i < 10; i++)
{
j += a[i];
/* This block is successfully removed. GCC figures
out that 15 is out of the range of i (0-9) and
removes the block */
if (i == 15) bar ();
/* This block is not removed, but could be */
if (i == -5) bar ();
}
}
Assembly:
.foo:
mflr 0
std 31,-8(1)
li 31,0
std 0,16(1)
stdu 1,-128(1)
.L12:
addi 0,31,1
extsw 31,0
cmpwi 7,31,9
cmpwi 6,31,-5
bgt- 7,.L14
.L4:
bne+ 6,.L12
ld 3,.LC2@toc(2)
bl .puts
nop
addi 0,31,1
extsw 31,0
cmpwi 7,31,9
cmpwi 6,31,-5
ble+ 7,.L4
.L14:
addi 1,1,128
ld 0,16(1)
ld 31,-8(1)
mtlr 0
blr
--
Summary: Missed opportunity for value range optimization
Product: gcc
Version: 3.5.0
Status: UNCONFIRMED
Severity: enhancement
Priority: P1
Component: other
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: steinmtz at us dot ibm dot com
CC: gcc-bugs at gcc dot gnu dot org,steinmtz at us dot ibm
dot com
GCC build triplet: powerpc64-linux
GCC host triplet: powerpc64-linux
GCC target triplet: powerpc64-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17100
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug tree-optimization/17100] Missed opportunity for value range optimization
2004-08-19 14:59 [Bug other/17100] New: Missed opportunity for value range optimization gcc-bugzilla at gcc dot gnu dot org
@ 2004-08-19 15:03 ` pinskia at gcc dot gnu dot org
2004-10-12 10:34 ` nathan 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 @ 2004-08-19 15:03 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-08-19 15:03 -------
Confirmed.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Component|other |tree-optimization
Ever Confirmed| |1
Keywords| |missed-optimization
Last reconfirmed|0000-00-00 00:00:00 |2004-08-19 15:03:47
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17100
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug tree-optimization/17100] Missed opportunity for value range optimization
2004-08-19 14:59 [Bug other/17100] New: Missed opportunity for value range optimization gcc-bugzilla at gcc dot gnu dot org
2004-08-19 15:03 ` [Bug tree-optimization/17100] " pinskia at gcc dot gnu dot org
@ 2004-10-12 10:34 ` nathan at gcc dot gnu dot org
2004-12-19 23:43 ` sebastian dot pop at cri dot ensmp dot fr
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: nathan at gcc dot gnu dot org @ 2004-10-12 10:34 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From nathan at gcc dot gnu dot org 2004-10-12 10:34 -------
I think this is an artifact of the design of the current value range
propagation. That's not really range propagation by comparison result CSEing.
The loop exit is i < 10, and the next comparison is i == 15. We can propagate
the 'i < 10' result
and deduce that i == 15 must be false. The later i == -5 can't be determined
from the result of i < 10.
I suspect this will be much easier to fix with a proper SSA VRP pass.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17100
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug tree-optimization/17100] Missed opportunity for value range optimization
2004-08-19 14:59 [Bug other/17100] New: Missed opportunity for value range optimization gcc-bugzilla at gcc dot gnu dot org
2004-08-19 15:03 ` [Bug tree-optimization/17100] " pinskia at gcc dot gnu dot org
2004-10-12 10:34 ` nathan at gcc dot gnu dot org
@ 2004-12-19 23:43 ` sebastian dot pop at cri dot ensmp dot fr
2005-04-24 11:48 ` pinskia at gcc dot gnu dot org
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: sebastian dot pop at cri dot ensmp dot fr @ 2004-12-19 23:43 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From sebastian dot pop at cri dot ensmp dot fr 2004-12-19 23:43 -------
Patch in autovect-branch:
http://gcc.gnu.org/ml/gcc-patches/2004-12/msg01444.html
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17100
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug tree-optimization/17100] Missed opportunity for value range optimization
2004-08-19 14:59 [Bug other/17100] New: Missed opportunity for value range optimization gcc-bugzilla at gcc dot gnu dot org
` (2 preceding siblings ...)
2004-12-19 23:43 ` sebastian dot pop at cri dot ensmp dot fr
@ 2005-04-24 11:48 ` pinskia at gcc dot gnu dot org
2005-06-02 18:50 ` dnovillo at gcc dot gnu dot org
2005-09-10 18:11 ` pinskia at gcc dot gnu dot org
5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-04-24 11:48 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-04-24 11:48 -------
i_8: VARYING
# i_8 = PHI <0(0), i_10(4)>;
<L2>:;
if (i_8 == -5) goto <L3>; else goto <L8>;
i_10 = i_8 + 1;
if (i_10 <= 9) goto <L2>; else goto <L6>;
i_10: [1, 2147483647]
Hmm, isn't i_10 signed still so why between 1 and -1, that does not make sense.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17100
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug tree-optimization/17100] Missed opportunity for value range optimization
2004-08-19 14:59 [Bug other/17100] New: Missed opportunity for value range optimization gcc-bugzilla at gcc dot gnu dot org
` (3 preceding siblings ...)
2005-04-24 11:48 ` pinskia at gcc dot gnu dot org
@ 2005-06-02 18:50 ` dnovillo at gcc dot gnu dot org
2005-09-10 18:11 ` pinskia at gcc dot gnu dot org
5 siblings, 0 replies; 7+ messages in thread
From: dnovillo at gcc dot gnu dot org @ 2005-06-02 18:50 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From dnovillo at gcc dot gnu dot org 2005-06-02 18:50 -------
Fixed. Likely with http://gcc.gnu.org/ml/gcc-patches/2005-06/msg00127.html, but
it may have been fixed earlier. The natural range for i_6 is computed as [0, 9]
so this isn't something that was folded using range equivalences.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.1.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17100
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug tree-optimization/17100] Missed opportunity for value range optimization
2004-08-19 14:59 [Bug other/17100] New: Missed opportunity for value range optimization gcc-bugzilla at gcc dot gnu dot org
` (4 preceding siblings ...)
2005-06-02 18:50 ` dnovillo at gcc dot gnu dot org
@ 2005-09-10 18:11 ` pinskia at gcc dot gnu dot org
5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-09-10 18:11 UTC (permalink / raw)
To: gcc-bugs
--
Bug 17100 depends on bug 18373, which changed state.
Bug 18373 Summary: [meta-bug] VRP Value Range Propagation
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18373
What |Old Value |New Value
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17100
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2005-09-10 18:11 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-19 14:59 [Bug other/17100] New: Missed opportunity for value range optimization gcc-bugzilla at gcc dot gnu dot org
2004-08-19 15:03 ` [Bug tree-optimization/17100] " pinskia at gcc dot gnu dot org
2004-10-12 10:34 ` nathan at gcc dot gnu dot org
2004-12-19 23:43 ` sebastian dot pop at cri dot ensmp dot fr
2005-04-24 11:48 ` pinskia at gcc dot gnu dot org
2005-06-02 18:50 ` dnovillo at gcc dot gnu dot org
2005-09-10 18:11 ` 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).