On 10/6/20 8:09 AM, Martin Liška wrote:
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

Ah, by just using the outgoing_range class, all you are getting is static edges.  so a TRUE edge is always a [1,1] and a false edge is [0,0]
I provided that class so you could get the constant edges on switches.

if you want to get actual ranges for ssa-names, you will need the ranger (which I think is going in today).  It uses those values as the starting point for winding back to calculate other dependent names.

Then  you will want to query the ranger for the range of index_5 on that edge..

so you will need a gimple ranger instance instead of an outgoing_range object.

Andrew

Reply via email to