Issue |
122942
|
Summary |
[mlir][presburger] "Isolated" local variables can produce crash or unexpected results in IntegerRelation/PresburgerRelation routines
|
Labels |
mlir:presburger
|
Assignees |
christopherbate
|
Reporter |
christopherbate
|
I've noticed an issue where "isolated" local variables can cause problems in the elimination of non-div locals (IntegerRelation -> PresburgerRelation) as well as in the set subtraction algorithm (`getSetDifference` in `PresburgerRelation.cpp`).
By "isolated" I mean that there is a local defined in the IntegerRelation system, but there may not be a constraint that links the local to other variables. This sounds contrived, but it can happen if a user constructs an IntegerRelation from an AffineMap where one of the domain variables is not used to calculate the range. Invoking `IntegerRelation::getRangeSet` would then turn all the domain variables into locals, resulting in a local which is not related to any other variable in the system.
If you then try to compute the "non-div local" representation, I noticed that the number of disjuncts can become much larger than if the local is eliminated (e.g. 2x for each unused local). Furthermore, I will sporadically run into an unreachable here https://github.com/llvm/llvm-project/blob/main/mlir/lib/Analysis/Presburger/Simplex.cpp#L1463. Will update this issue with a concise reproducer.
As a workaround, I added a routine to eliminate such locals whenever I construct an IntegerRelation. It doesn't look like any of the existing simplification routines in `IntegerRelation` know how to remove with such locals.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs