This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/25148] compare_values assumes that CST in a + CST (and a - CST) is always postive



------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]