[PATCH] Add if-chain to switch conversion pass.
Martin Liška
mliska@suse.cz
Tue Oct 6 12:09:25 GMT 2020
On 10/2/20 4:19 PM, Andrew MacLeod wrote:
> On 10/2/20 9:26 AM, Martin Liška wrote:
>>> Yes, you simply get all sorts of conditions that hold when a condition is
>>> true, not just those based on the SSA name you put in. But it occured
>>> to me that the use-case is somewhat different - for switch-conversion
>>> you want to know whether the test _exactly_ matches a range test,
>>> the VRP worker will not tell you that. For example if you had
>>> if (x && a > 3 && a < 7) then it will give you 'a in [4, 6]' and it might
>>> not give you 'x in [1, 1]' (for example if x is float). But that's required
>>> for correctness.
>>
>> Hello.
>>
>> Adding Ranger guys. Is it something that can be handled by the upcoming changes in VRP?
>
> Presumably. It depends on exactly how the code lays out. We dont process floats, so we wont know anything about the float (at least this release :-). We will sort through complex logicals and tell you what we do know, so if x is integral
>
>
> if (x && a > 3 && a < 7)
>
> will give you, on the final true edge:
>
> x_5(D) int [-INF, -1][1, +INF]
> a_6(D) int [4, 6]
>
>
> IF x is a float, then we wont give you anything for x obviously, but on the eventual true edge we'd still give you
> a_6(D) int [4, 6]
Which is an acceptable limitation for me.
However, I can't convince ranger to give me a proper ranges for. I'm using the following
code snippet:
outgoing_range query;
edge e;
edge_iterator ei;
FOR_EACH_EDGE (e, ei, bb->succs)
{
int_range_max range;
if (query.edge_range_p (range, e))
{
if (dump_file)
{
fprintf (dump_file, "%d->%d: ", e->src->index, e->dest->index);
range.dump(dump_file);
fprintf (dump_file, "\n");
}
}
}
if (9 <= index && index <= 123)
return 123;
<bb 2> :
index.0_1 = (unsigned int) index_5(D);
_2 = index.0_1 + 4294967287;
if (_2 <= 114)
goto <bb 3>; [INV]
else
goto <bb 4>; [INV]
I get:
2->3: _Bool [1, 1]
2->4: _Bool [0, 0]
Can I get to index_5 [9, 123] ?
Thanks,
Martin
>
>
> Andrew
>
>
>
More information about the Gcc-patches
mailing list