isl_map_intersect: special case obviously equal inputs
commit9f663ab9e19a4a91779f1c6f75fece9d58fce2ab
authorSven Verdoolaege <sven.verdoolaege@gmail.com>
Mon, 11 Jun 2018 14:18:17 +0000 (11 16:18 +0200)
committerSven Verdoolaege <sven.verdoolaege@gmail.com>
Tue, 12 Jun 2018 20:58:59 +0000 (12 22:58 +0200)
treee0b53fe097c00794ade713eab19fdf48110603fe
parent8e9f55ce2f4fd7f2690543e38bd3265dd1be6ca9
isl_map_intersect: special case obviously equal inputs

When operating on functions on a shared domain, it is not uncommon
for this domain to get intersected with itself.
If the domain is described by multiple disjuncts and
if these disjuncts are not mutually disjoint, then each
such intersection will result in a doubling of the number
of disjuncts.
Detect this special case and simply return one of the inputs
if the two inputs are obviously equal.

Do so after the special casing for adding a single constraint
introduced in isl-0.01-131-ged3b444376 (isl_map_intersect:
add special case for adding a single constraint,
Sun Dec 6 11:54:41 2009 +0100).  The motivation for that change
is rather terse, but it was presumably meant to speed up
the successive addition of individual constraints.
Introducing an implicit normalization in this process
can slow it down without bringing any significant benefits.

This is similar to the change in isl-0.12.1-222-g1a5d6c3c78
(isl_map_union: special case obviously equal inputs,
Tue Feb 4 11:20:45 2014 +0100).
As in that commit, this commit also ends up modifying
some of the AST generation test cases because
the check for obviously equal inputs normalizes
the constraints of those inputs.

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
isl_map.c
isl_test.c
test_inputs/codegen/cloog/classen.c
test_inputs/codegen/correlation.c