This patch introduces the cut case. If one polytope has only cutting and
redundant inequalities for the other and the facet of the cutting
inequalities are contained within the other polytope, then the polytopes are
be combined into a polytope consisting only of their respective
redundant constraints.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
mlir/lib/Analysis/Presburger/PresburgerSet.cpp | ||
---|---|---|
382–384 | ||
397–399 | I think if i != j, it is already implied that the size of the arrays is at least 2. | |
400–402 | Please add an assert to check that i != j. | |
417–422 | ||
445–446 | You should copy number of local ids too. | |
448–452 | You can use range based for loop here. | |
591–601 | Could you write a comment when this case is taken? |
Please make all the free functions static.
mlir/lib/Analysis/Presburger/PresburgerSet.cpp | ||
---|---|---|
385 | I think this should return a bool, it's not really a success/failure result. | |
387 | Pass the cached simp instead of constructin from scratch? You can snapshot, add the equality, check redundancy, then rollback and return | |
389–393 | !isRedundantInequality would be shorter | |
389–393 | can use std::all_of | |
439–445 | drop braces for single-line bodies | |
456–460 | ++k |
Addressed comments and rewrote handling of equalities after finding a case that was impossible to handle currently. The new version types both inequalities that make an equality and considers their types as well.
In the earlier version, the negated inequality vector was freed before being used. This patch introduces a fix that tracks all negated equalities in a vector throughout coalescePair. In this way, they don't get freed before the new polytope is constructed.
mlir/lib/Analysis/Presburger/PresburgerSet.cpp | ||
---|---|---|
391 | Why this cast? | |
433 | I feel this name can be more descriptive. What about just calling it coalescePairCutCase? | |
447 | Please capture by reference. | |
448–449 | Why these copies? | |
502–507 | This section is repeated three times in this patch. IMO, you can simply rename typeInequalities to typeInequality, make it take an ArrayRef to an ineq instead of an integer polyhedron, and move the rest of the logic into cutCase directly. | |
509–512 | You can use the static function getComplementIneq |
Address further comments. In particular, made free functions static, refactor typing of inequalities and equalities.
mlir/lib/Analysis/Presburger/PresburgerSet.cpp | ||
---|---|---|
391 | When not capturing by reference, the captured variables are implicitly const. That's why I needed this cast (and the copies further down). Capturing by reference solved the problem. | |
509–512 | Not quite. For t(x), getComplementIneq returns -t(x) - 1, whereas I require -t(x). I guess I can use getComplementIneq and then change the constant, but that seems wasteful IMO. |
LGTM. Please update the documentation too for the variable name change:
mlir/lib/Analysis/Presburger/PresburgerSet.cpp | ||
---|---|---|
474 |