https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96351

--- Comment #4 from Andrew Macleod <amacleod at redhat dot com> ---

=========== BB 5 ============
str_3(D)        [irange] int [1, +INF]
Relational : (pszTmp_10 > str_3(D))
    <bb 5> [local count: 310901944]:
    pszTmp_10 = str_3(D) + 1;
    goto <bb 7>; [100.00%]

pszTmp_10 : [irange] int [2, +INF] MASK 0x7fffffff VALUE 0x0

=========== BB 6 ============
Relational : (pszTmp_12 > pszTmp_11)
    <bb 6> [local count: 2515479380]:
    pszTmp_12 = pszTmp_11 + 1;

pszTmp_12 : [irange] int [3, +INF] MASK 0x7fffffff VALUE 0x0

=========== BB 7 ============
Imports: _13
Exports: _13
pszTmp_10       [irange] int [2, +INF] MASK 0x7fffffff VALUE 0x0
Equivalence set : [pszTmp_11]
    <bb 7> [local count: 2826381324]:
    # pszTmp_11 = PHI <pszTmp_10(5), pszTmp_12(6)>     
    _13 = f (pszTmp_11);
    if (_13 != 0)
      goto <bb 6>; [89.00%]
    else
      goto <bb 8>; [11.00%]

pszTmp_11 : [irange] int [2, +INF] MASK 0x7fffffff VALUE 0x0
7->6  (T) _13 :         [irange] int [-INF, -1][1, +INF]
7->8  (F) _13 :         [irange] int [0, 0]

at the PHI npde:
# pszTmp_11 = PHI <pszTmp_10(5), pszTmp_12(6)> 

We know (pszTmp_10 > str_3(D)) coming in from bb5.
we know (pszTmp_12 > pszTmp_11) from bb6

What we dont currently do is create relations for a PHI def from what we can
learn from the arguments.
we could determine that pszTmp_11 is increasing in value from bb6 since that
argument is > pszTmp_11.
and with argument 1 being the initial value of the increasing value, we could
transitively conclude pszTmp_11 > str_3(D) as well.

=========== BB 8 ============
Imports: str_3(D)  pszTmp_8
Exports: str_3(D)  pszTmp_8
str_3(D)        [irange] int [1, +INF]
Equivalence set : [pszTmp_8, pszTmp_11]
    <bb 8> [local count: 310901944]:
    # pszTmp_8 = PHI <pszTmp_11(7)>
    if (str_3(D) == pszTmp_8)
      goto <bb 3>; [1.49%]
    else
      goto <bb 9>; [98.51%]


pszTmp_8 is in an equivlaence with pszTmp_11, so we would then  elimiate the
comparison.

This is related to 116753... we need to do some relation applications to the
PHI def based on arguments.

Reply via email to