https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70879
--- Comment #5 from Andrew Macleod ---
On 08/18/2017 06:13 PM, law at redhat dot com wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70879
>
> Jeffrey A. Law changed:
>
> What|Removed |Added
>
> Status|NEW |RESOLVED
> Resolution|--- |FIXED
>
> --- Comment #4 from Jeffrey A. Law ---
> This was fixed by RIchi's change for pr71433.
>
Made a bunch of updates this week, and things are in decent shape I think.
so looking at that test case with the code base as of this afternoon, if
we expand irange to have 3 sub-ranges (which I think long term we will
may need)
void
foo (int a)
{
if (a != 5 && a != 10)
bar ();
if (a == 10)
baz ();
}
we get gimple
[0.00%] [count: INV]:
_1 = a_6(D) != 5;
_2 = a_6(D) != 10;
_3 = _1 & _2;
if (_3 != 0)
goto ; [INV] [count: INV]
else
goto ; [INV] [count: INV]
[0.00%] [count: INV]:
bar ();
[0.00%] [count: INV]:
if (a_6(D) == 10)
goto ; [INV] [count: INV]
else
goto ; [INV] [count: INV]
shows
BB 2: T: _1 [0x0001, 0x0001] precision = 1
BB 2: T: _2 [0x0001, 0x0001] precision = 1
BB 2: T: _3 [0x, 0x] precision = 1
BB 2: T: a_6(D) [0x8000, 0x4][0x6, 0x9][0xb,
0x7fff] precision = 32
BB 2: F: _1 [0x0, 0x0001] precision = 1
BB 2: F: _2 [0x0, 0x0001] precision = 1
BB 2: F: _3 [0x0, 0x0] precision = 1
BB 2: F: a_6(D) [0x5, 0x5][0xa, 0xa] precision = 32
BB 4: T: a_6(D) [0xa, 0xa] precision = 32
BB 4: F: a_6(D) [0x8000, 0x9][0xb, 0x7fff]
precision = 32
so the true side of bb2 shows the range of a_6 to be everything except 5
and 10 [0x8000, 0x4][0x6, 0x9][0xb, 0x7fff] precision = 32
and the true side of bb4, leading to the call to baz(), a_6 has to have
a value of 10.. if you intersect those 2 ranges on that path... voila!!
its a NULL range meaning that call can't happen on that path
2->3->4->5, letting you do your thing..
So that is promising...
Andrew
Over the weekend im going to consider options for handling an increase
of precision in ranges without going full on dynamic.