On 10/6/20 4:12 PM, Jakub Jelinek wrote:
On Tue, Oct 06, 2020 at 03:48:38PM +0200, Martin Liška wrote:
On 10/6/20 9:47 AM, Richard Biener wrote:
But is it really extensible with the current implementation?  I doubt so.

I must agree with the statement. So let's make the pass properly.
I would need a help with the algorithm where I'm planning to do the following
steps:

1) for each BB ending with a gcond, parse index variable and it's VR;
    I'll support:
    a) index == 123 ([123, 123])
    b) 1 <= index && index <= 9 ([1, 9])
    c) index == 123 || index == 12345 ([123, 123] [12345, 12345])
    d) index != 1 ([1, 1])
    e) index != 1 && index != 5 ([1, 1] [5, 5])

The fold_range_test created cases are essential to support, so
f) index - 123U < 456U ([123, 456+123])
g) (unsigned) index - 123U < 456U (ditto)
but the discovery should actually recurse on all of those forms, so it will
handle
(unsigned) index - 123U < 456U || (unsigned) index - 16384U <= 32711U
etc.
You can see what reassoc init_range_entry does and do something similar?

All right, I started to use init_range_entry in combination with 
linearize_expr_tree.
One thing I have problem with is that linearize_expr_tree doesn't properly mark
all statements as visited for cases like:

  <bb 4> :
  index2.1_1 = (unsigned int) index2_16(D);
  _2 = index2.1_1 + 4294967196;
  _3 = _2 <= 100;
  _5 = index2.1_1 + 4294966996;
  _6 = _5 <= 33;
  _7 = _3 | _6;
  if (_7 != 0)
    goto <bb 5>; [INV]
  else
    goto <bb 6>; [INV]

As seen, all statements in this BB are used by the final _7 != 0 and it would
be handy for me to identify all statements that should be hoisted.

Thoughts how can I achieve that?
Thanks,
Martin

Reply via email to