-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 <[email protected]>
- Loading branch information
Sven Verdoolaege
committed
Jun 12, 2018
1 parent
8e9f55c
commit 9f663ab
Showing
4 changed files
with
92 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,86 +1,63 @@ | ||
if (m >= 1) { | ||
if (m == 1) { | ||
S1(0, 1, 1, 1); | ||
S8(0, 1); | ||
} else { | ||
S1(0, 1, 1, 1); | ||
S1(0, 1, 1, 1); | ||
if (m >= 2) { | ||
S2(0, 1, 1, 1, 1, 1, 2, 1); | ||
S3(0, 1, 1, 2, 1, 1, 1, 2); | ||
S4(0, 1, 2, 2, 1, 1, 2, 2); | ||
S8(0, 1); | ||
} | ||
for (int c0 = 1; c0 < 2 * m - 3; c0 += 1) { | ||
if (c0 + 1 == m) { | ||
S5(m - 2, 1, m - 1, 1, m - 1, 1, m, 1); | ||
S1(m - 1, 1, m, 1); | ||
S3(m - 1, 1, m, 2, m, 1, m, 2); | ||
} else if (m >= c0 + 2) { | ||
S5(c0 - 1, 1, c0, 1, c0, 1, c0 + 1, 1); | ||
S1(c0, 1, c0 + 1, 1); | ||
S2(c0, 1, c0 + 1, 1, c0 + 1, 1, c0 + 2, 1); | ||
S4(c0, 1, c0 + 2, 2, c0 + 1, 1, c0 + 2, 2); | ||
S3(c0, 1, c0 + 1, 2, c0 + 1, 1, c0 + 1, 2); | ||
} else { | ||
S5(c0 - 1, -m + c0 + 2, c0, -m + c0 + 2, m - 1, -m + c0 + 2, m, -m + c0 + 2); | ||
S6(c0 - 1, -m + c0 + 1, c0, -m + c0 + 2, m, -m + c0 + 1, m, -m + c0 + 2); | ||
S1(c0, -m + c0 + 2, m, -m + c0 + 2); | ||
S3(c0, -m + c0 + 2, c0 + 1, -m + c0 + 3, m, -m + c0 + 2, m, -m + c0 + 3); | ||
} | ||
for (int c1 = max(2, -m + c0 + 3); c1 <= min(m - 1, c0); c1 += 1) { | ||
S5(c0 - 1, c1, c0, c1, c0 - c1 + 1, c1, c0 - c1 + 2, c1); | ||
S7(c0 - 1, c1 - 1, c0 + 1, c1, c0 - c1 + 2, c1 - 1, c0 - c1 + 3, c1); | ||
S6(c0 - 1, c1 - 1, c0, c1, c0 - c1 + 2, c1 - 1, c0 - c1 + 2, c1); | ||
S1(c0, c1, c0 - c1 + 2, c1); | ||
S2(c0, c1, c0 + 1, c1, c0 - c1 + 2, c1, c0 - c1 + 3, c1); | ||
S4(c0, c1, c0 + 2, c1 + 1, c0 - c1 + 2, c1, c0 - c1 + 3, c1 + 1); | ||
S3(c0, c1, c0 + 1, c1 + 1, c0 - c1 + 2, c1, c0 - c1 + 2, c1 + 1); | ||
} | ||
if (c0 + 1 == m) { | ||
S7(m - 2, m - 1, m, m, 1, m - 1, 2, m); | ||
S6(m - 2, m - 1, m - 1, m, 1, m - 1, 1, m); | ||
S1(m - 1, m, 1, m); | ||
S2(m - 1, m, m, m, 1, m, 2, m); | ||
} else if (c0 >= m) { | ||
S5(c0 - 1, m, c0, m, -m + c0 + 1, m, -m + c0 + 2, m); | ||
S7(c0 - 1, m - 1, c0 + 1, m, -m + c0 + 2, m - 1, -m + c0 + 3, m); | ||
S6(c0 - 1, m - 1, c0, m, -m + c0 + 2, m - 1, -m + c0 + 2, m); | ||
S1(c0, m, -m + c0 + 2, m); | ||
S2(c0, m, c0 + 1, m, -m + c0 + 2, m, -m + c0 + 3, m); | ||
S8(0, 1); | ||
for (int c0 = 1; c0 < 2 * m - 1; c0 += 1) { | ||
if (2 * m >= c0 + 3) { | ||
if (c0 + 1 == m) { | ||
S5(m - 2, 1, m - 1, 1, m - 1, 1, m, 1); | ||
S1(m - 1, 1, m, 1); | ||
S3(m - 1, 1, m, 2, m, 1, m, 2); | ||
} else if (m >= c0 + 2) { | ||
S5(c0 - 1, 1, c0, 1, c0, 1, c0 + 1, 1); | ||
S1(c0, 1, c0 + 1, 1); | ||
S2(c0, 1, c0 + 1, 1, c0 + 1, 1, c0 + 2, 1); | ||
S4(c0, 1, c0 + 2, 2, c0 + 1, 1, c0 + 2, 2); | ||
S3(c0, 1, c0 + 1, 2, c0 + 1, 1, c0 + 1, 2); | ||
} else { | ||
S5(c0 - 1, -m + c0 + 2, c0, -m + c0 + 2, m - 1, -m + c0 + 2, m, -m + c0 + 2); | ||
S6(c0 - 1, -m + c0 + 1, c0, -m + c0 + 2, m, -m + c0 + 1, m, -m + c0 + 2); | ||
S1(c0, -m + c0 + 2, m, -m + c0 + 2); | ||
S3(c0, -m + c0 + 2, c0 + 1, -m + c0 + 3, m, -m + c0 + 2, m, -m + c0 + 3); | ||
} | ||
for (int c1 = max(2, -m + c0 + 3); c1 <= min(m - 1, c0); c1 += 1) { | ||
S5(c0 - 1, c1, c0, c1, c0 - c1 + 1, c1, c0 - c1 + 2, c1); | ||
S7(c0 - 1, c1 - 1, c0 + 1, c1, c0 - c1 + 2, c1 - 1, c0 - c1 + 3, c1); | ||
S6(c0 - 1, c1 - 1, c0, c1, c0 - c1 + 2, c1 - 1, c0 - c1 + 2, c1); | ||
S1(c0, c1, c0 - c1 + 2, c1); | ||
S2(c0, c1, c0 + 1, c1, c0 - c1 + 2, c1, c0 - c1 + 3, c1); | ||
S4(c0, c1, c0 + 2, c1 + 1, c0 - c1 + 2, c1, c0 - c1 + 3, c1 + 1); | ||
S3(c0, c1, c0 + 1, c1 + 1, c0 - c1 + 2, c1, c0 - c1 + 2, c1 + 1); | ||
} | ||
if (c0 + 1 == m) { | ||
S7(m - 2, m - 1, m, m, 1, m - 1, 2, m); | ||
S6(m - 2, m - 1, m - 1, m, 1, m - 1, 1, m); | ||
S1(m - 1, m, 1, m); | ||
S2(m - 1, m, m, m, 1, m, 2, m); | ||
} else if (m >= c0 + 2) { | ||
S6(c0 - 1, c0, c0, c0 + 1, 1, c0, 1, c0 + 1); | ||
S7(c0 - 1, c0, c0 + 1, c0 + 1, 1, c0, 2, c0 + 1); | ||
S1(c0, c0 + 1, 1, c0 + 1); | ||
S2(c0, c0 + 1, c0 + 1, c0 + 1, 1, c0 + 1, 2, c0 + 1); | ||
S4(c0, c0 + 1, c0 + 2, c0 + 2, 1, c0 + 1, 2, c0 + 2); | ||
S3(c0, c0 + 1, c0 + 1, c0 + 2, 1, c0 + 1, 1, c0 + 2); | ||
} else { | ||
S5(c0 - 1, m, c0, m, -m + c0 + 1, m, -m + c0 + 2, m); | ||
S7(c0 - 1, m - 1, c0 + 1, m, -m + c0 + 2, m - 1, -m + c0 + 3, m); | ||
S6(c0 - 1, m - 1, c0, m, -m + c0 + 2, m - 1, -m + c0 + 2, m); | ||
S1(c0, m, -m + c0 + 2, m); | ||
S2(c0, m, c0 + 1, m, -m + c0 + 2, m, -m + c0 + 3, m); | ||
} | ||
} else { | ||
S6(c0 - 1, c0, c0, c0 + 1, 1, c0, 1, c0 + 1); | ||
S7(c0 - 1, c0, c0 + 1, c0 + 1, 1, c0, 2, c0 + 1); | ||
S1(c0, c0 + 1, 1, c0 + 1); | ||
S2(c0, c0 + 1, c0 + 1, c0 + 1, 1, c0 + 1, 2, c0 + 1); | ||
S4(c0, c0 + 1, c0 + 2, c0 + 2, 1, c0 + 1, 2, c0 + 2); | ||
S3(c0, c0 + 1, c0 + 1, c0 + 2, 1, c0 + 1, 1, c0 + 2); | ||
S5(2 * m - 3, m, 2 * m - 2, m, m - 1, m, m, m); | ||
S6(2 * m - 3, m - 1, 2 * m - 2, m, m, m - 1, m, m); | ||
S1(2 * m - 2, m, m, m); | ||
} | ||
for (int c2 = max(1, -m + c0 + 2); c2 <= min(m, c0 + 1); c2 += 1) | ||
S8(c0, c2); | ||
} | ||
if (m >= 2) { | ||
if (m >= 3) { | ||
S5(2 * m - 4, m - 1, 2 * m - 3, m - 1, m - 1, m - 1, m, m - 1); | ||
S6(2 * m - 4, m - 2, 2 * m - 3, m - 1, m, m - 2, m, m - 1); | ||
S1(2 * m - 3, m - 1, m, m - 1); | ||
S3(2 * m - 3, m - 1, 2 * m - 2, m, m, m - 1, m, m); | ||
S5(2 * m - 4, m, 2 * m - 3, m, m - 2, m, m - 1, m); | ||
S7(2 * m - 4, m - 1, 2 * m - 2, m, m - 1, m - 1, m, m); | ||
S6(2 * m - 4, m - 1, 2 * m - 3, m, m - 1, m - 1, m - 1, m); | ||
S1(2 * m - 3, m, m - 1, m); | ||
} else { | ||
S5(0, 1, 1, 1, 1, 1, 2, 1); | ||
S1(1, 1, 2, 1); | ||
S3(1, 1, 2, 2, 2, 1, 2, 2); | ||
S7(0, 1, 2, 2, 1, 1, 2, 2); | ||
S6(0, 1, 1, 2, 1, 1, 1, 2); | ||
S1(1, 2, 1, 2); | ||
} | ||
S2(2 * m - 3, m, 2 * m - 2, m, m - 1, m, m, m); | ||
for (int c2 = m - 1; c2 <= m; c2 += 1) | ||
S8(2 * m - 3, c2); | ||
S5(2 * m - 3, m, 2 * m - 2, m, m - 1, m, m, m); | ||
S6(2 * m - 3, m - 1, 2 * m - 2, m, m, m - 1, m, m); | ||
S1(2 * m - 2, m, m, m); | ||
S8(2 * m - 2, m); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters