This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/25148] compare_values assumes that CST in a + CST (and a - CST) is always postive
- From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 29 Nov 2005 02:07:10 -0000
- Subject: [Bug tree-optimization/25148] compare_values assumes that CST in a + CST (and a - CST) is always postive
- References: <bug-25148-6528@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #2 from pinskia at gcc dot gnu dot org 2005-11-29 02:07 -------
Actually you can produce the missed optimization for g++.dg/tree-ssa/pr18178.C
with -fwrapv, we know that the range is [0, a-1] so that it has to be less than
a.
The code for ASSERTS:
i_2 = ASSERT_EXPR <i_1, i_1 < D.2100_4>;
D.2100_28 = ASSERT_EXPR <D.2100_4, i_2 < D.2100_4>;
D.2100_5 = D.2100_28;
if (i_2 >= D.2100_28) goto <L1>; else goto <L2>;
The important RANGES:
i_2: [-INF, D.2100_4 + -1] EQUIVALENCES: { i_1 } (1 elements)
D.2100_5: [i_2 + 1, +INF] EQUIVALENCES: { D.2100_4 D.2100_28 } (2 elements)
In fact this is important for Java (GCJ) because -fwrapv is on by default.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |dnovillo at gcc dot gnu dot
| |org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25148