PetScan::set_upper_bounds: handle arrays declared inside loops
commita9014aedbccea2f494a4bac55cf4c77a39f7326a
authorSven Verdoolaege <skimo@kotnet.org>
Thu, 17 Jul 2014 17:27:14 +0000 (17 19:27 +0200)
committerSven Verdoolaege <skimo@kotnet.org>
Thu, 17 Jul 2014 17:32:47 +0000 (17 19:32 +0200)
treea88c452656af98bd4504cdd21b0884a04f4c490f
parentf4f8195223a303321cf5d91aabea4cd795164149
PetScan::set_upper_bounds: handle arrays declared inside loops

Support for arrays declared inside loops was broken by 1bcd2f8
(pet_scop_from_pet_tree: extract pet_scop from the root down to the leaves,
Wed Jan 1 14:32:37 2014 +0100) because we started keeping track
of the outer loop iterators in the pet_context, which would then
appear in the affine expression extracted from the size expression
while an expression with a zero-dimensional domain is expected.

Remove those dimensions from the affine expression, assuming the
expression does not depend on them.

If the affine expression extracted from the size expression does
depend on the outer loop iterators then the original code (before
the breakage explained above) would produce a meaningless result
with an empty context.  This commits ignores such size expressions,
effectively leaving the extent of the array unknown.
In future, we may want to either warn about this situation or
compute a static upper bound on the size expression.

Reported-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
scan.cc
tests/decl4.c [new file with mode: 0644]
tests/decl4.scop [new file with mode: 0644]