clast: drop loops with fractional lower and upper bounds in same unit interval
commit9f9813935ff32eafdd78fbef685c5ba1b2695d0a
authorSven Verdoolaege <sven@cs.kuleuven.be>
Sun, 3 May 2009 21:08:01 +0000 (3 22:08 +0100)
committerSven Verdoolaege <skimo@kotnet.org>
Tue, 5 May 2009 13:35:42 +0000 (5 15:35 +0200)
tree2de14b755a4dd0f164068bef038f1b843aba651a
parent0b9f9b177d1570354259d3d2ce257dc7a7c980c6
clast: drop loops with fractional lower and upper bounds in same unit interval

If the lower or upper bound of a loop is a fractional constant,
then clast_bound_from_constraint will round it up or down.
If both constant bounds happen to lie inside the same unit interval,
then the rounded up lower bound will actually end up being
larger than the rounded down upper bound, resulting in code
like

    for (t0=200;t0<=199;t0++) {
      for (t2=50*t0;t2<=9999;t2++) {
for (t3=0;t3<=t2;t3++) {
  S1(i = t0,j = t2,k = t3) ;
}
      }
    }

Although such loops are technically correct, they do look a bit
strange, so we remove them by checking for a constant lower bound
that is bigger than the corresponding constant upper bound.

Note that this is only an issue for the PolyLib backend, as the isl
backend would have removed the sets corresponding to such loops
at a much earlier stage.

Reported by Uday K Bondhugula <bondhugu@cse.ohio-state.edu>

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
source/clast.c
test/Makefile.am
test/constbound.cloog [new file with mode: 0644]
test/constbound.good.c [new file with mode: 0644]
test/isl/constbound.c [new file with mode: 0644]
test/polylib/constbound.c [new file with mode: 0644]