public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/52589] New: VRP missed optimization
@ 2012-03-14 16:13 jakub at gcc dot gnu.org
2012-03-14 18:01 ` [Bug tree-optimization/52589] " jakub at gcc dot gnu.org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-03-14 16:13 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52589
Bug #: 52589
Summary: VRP missed optimization
Classification: Unclassified
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: normal
Priority: P3
Component: tree-optimization
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: jakub@gcc.gnu.org
extern void link_error (void);
void
foo (unsigned int s)
{
if (s + 0x70000000 < 0xf0000000U)
{
if (s >= 0x80000000U && s < 0x90000000U)
link_error ();
}
}
void
bar (unsigned int s)
{
if (s + 0x70000000 >= 0xf0000000U)
{
if (s < 0x80000000U || s >= 0x90000000U)
link_error ();
}
}
In the above testcase, bar is optimized fine (VRP adds an ASSERT_EXPR with
range [0x80000000, 0x8fffffff] and optimizes away the test), but in foo it
isn't - the range there is ~[0x80000000, 0x8ffffffff] and we don't handle the
VR_ANTI_RANGE somewhere where we should.
I've noticed this while working on PR52267 - the vrp65.c testcase that I'm
bootstrapping there right now needs to have 4 tests commented out (well,
replaced by checks of a few selected values from the range which VRP optimizes
out properly).
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/52589] VRP missed optimization
2012-03-14 16:13 [Bug tree-optimization/52589] New: VRP missed optimization jakub at gcc dot gnu.org
@ 2012-03-14 18:01 ` jakub at gcc dot gnu.org
2012-03-15 9:27 ` pinskia at gcc dot gnu.org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-03-14 18:01 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52589
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-03-14 17:24:30 UTC ---
The problem is in extract_range_from_binary_expr_1, we have
s_7 = ASSERT_EXPR <s_1(D), s_1(D) + 1879048192 <= 4026531839>;
D.1721_3 = s_7 + 2147483648;
if (D.1721_3 <= 268435455)
s_7 has range ~[2147483648, 2415919103] (i.e. VR_ANTI_RANGE), the constant
obviously [2147483648, 2147483648] (i.e. VR_RANGE), but as vr0.type !=
vr1.type,
we drop it to varying, while we could combine that ~[0x80000000, 0x8fffffff]
+ [0x80000000, 0x80000000] into ~[0, 0xfffffff] (at least, for TYPE_UNSIGNED
addition and perhaps limited only to constants (i.e. vr1.min == vr1.max
VR_RANGE).
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/52589] VRP missed optimization
2012-03-14 16:13 [Bug tree-optimization/52589] New: VRP missed optimization jakub at gcc dot gnu.org
2012-03-14 18:01 ` [Bug tree-optimization/52589] " jakub at gcc dot gnu.org
@ 2012-03-15 9:27 ` pinskia at gcc dot gnu.org
2012-06-29 12:56 ` glisse at gcc dot gnu.org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-03-15 9:27 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52589
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2012-03-15
Ever Confirmed|0 |1
Severity|normal |enhancement
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-03-15 09:05:07 UTC ---
Confirmed.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/52589] VRP missed optimization
2012-03-14 16:13 [Bug tree-optimization/52589] New: VRP missed optimization jakub at gcc dot gnu.org
2012-03-14 18:01 ` [Bug tree-optimization/52589] " jakub at gcc dot gnu.org
2012-03-15 9:27 ` pinskia at gcc dot gnu.org
@ 2012-06-29 12:56 ` glisse at gcc dot gnu.org
2012-06-29 13:12 ` rguenth at gcc dot gnu.org
2012-06-29 13:18 ` rguenth at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: glisse at gcc dot gnu.org @ 2012-06-29 12:56 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52589
Marc Glisse <glisse at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |glisse at gcc dot gnu.org
--- Comment #3 from Marc Glisse <glisse at gcc dot gnu.org> 2012-06-29 12:56:09 UTC ---
This looks related to bug 30318 and seems to have been fixed by Richard's
recent VRP patches.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/52589] VRP missed optimization
2012-03-14 16:13 [Bug tree-optimization/52589] New: VRP missed optimization jakub at gcc dot gnu.org
` (2 preceding siblings ...)
2012-06-29 12:56 ` glisse at gcc dot gnu.org
@ 2012-06-29 13:12 ` rguenth at gcc dot gnu.org
2012-06-29 13:18 ` rguenth at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-06-29 13:12 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52589
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
--- Comment #4 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-06-29 13:12:15 UTC ---
Indeed. I'll add the testcase to the testsuite.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/52589] VRP missed optimization
2012-03-14 16:13 [Bug tree-optimization/52589] New: VRP missed optimization jakub at gcc dot gnu.org
` (3 preceding siblings ...)
2012-06-29 13:12 ` rguenth at gcc dot gnu.org
@ 2012-06-29 13:18 ` rguenth at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-06-29 13:18 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52589
--- Comment #5 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-06-29 13:17:49 UTC ---
Author: rguenth
Date: Fri Jun 29 13:17:44 2012
New Revision: 189073
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=189073
Log:
2012-06-29 Richard Guenther <rguenther@suse.de>
PR tree-optimization/52589
* gcc.dg/tree-ssa/vrp70.c: New testcase.
Added:
trunk/gcc/testsuite/gcc.dg/tree-ssa/vrp70.c
Modified:
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-06-29 13:18 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-14 16:13 [Bug tree-optimization/52589] New: VRP missed optimization jakub at gcc dot gnu.org
2012-03-14 18:01 ` [Bug tree-optimization/52589] " jakub at gcc dot gnu.org
2012-03-15 9:27 ` pinskia at gcc dot gnu.org
2012-06-29 12:56 ` glisse at gcc dot gnu.org
2012-06-29 13:12 ` rguenth at gcc dot gnu.org
2012-06-29 13:18 ` rguenth at gcc dot gnu.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).