isl_ast_codegen.c: add_node: replace gist by pure specialization
The main purpose of the "domain" set computed in add_node
is to detect strides. The same set is later also used
to intersect "bounds" with additional equalities and
in the calls to exact_bound from refine_generic in
case there are no lower or upper bounds in "bounds".
The set is also used inside add_node to check if "bounds"
conflict with the build domain.
The call to isl_ast_build_compute_gist has several effects
- it plugs in the known values of outer loop iterators
- it detects conflicts with the build domain
- it may detect additional equalities
- it computes explicit representations for the divs
- it removes some constraints implied by the build domain
The final effect is undesired as it may result in the loss
of stride information as in the new test case.
In particular, the generated code would look like
for (int c0 = 0; c0 < n - 1; c0 += 32)
for (int c1 = c0 - 30; c1 < n; c1 += 1)
if (c1 % 32 == 0)
instead of
for (int c0 = 0; c0 < n - 1; c0 += 32)
for (int c1 = c0; c1 < n; c1 += 32)
because in part of the schedule domain c0 and c1 are equal and
we already know that c0 is a multiple of 32. In that part of
the schedule domain, the gist therefore drops the information
that c1 is also a multiple of 32.
We therefore remove the gist computation and restrict
ourselves to plugging in the known values of outer loop iterators.
It is not clear if the computation of explicit representations
was intended, but it does seem to have a significant effect
on some of the test cases. We therefore keep this computation,
but we have to do it explicitly now.
We may want to reconsider whether this computation should
be performed at a later stage.
The check for conflicts with the build domain is also made
explicit in this commit.
The only effect we do not keep here is the possible detection
of additional equalities. It is not clear if this ever has
any effect in practical cases, but we can still add it back later
if it turns out to be useful later.
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>