[Mlir-commits] [mlir] [MLIR][Presburger][NFC] Don't add empty regions when unioning PWMA functions (PR #182468)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Fri Feb 20 02:23:39 PST 2026


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir

Author: Yue Huang (AdUhTkJm)

<details>
<summary>Changes</summary>

This will prevent exponential behaviour in lexicographic maximum computation, where the `tiebreak` predicate is very likely to return empty regions.

---
Full diff: https://github.com/llvm/llvm-project/pull/182468.diff


1 Files Affected:

- (modified) mlir/lib/Analysis/Presburger/PWMAFunction.cpp (+3) 


``````````diff
diff --git a/mlir/lib/Analysis/Presburger/PWMAFunction.cpp b/mlir/lib/Analysis/Presburger/PWMAFunction.cpp
index 55d17ad47e991..2c55e40646345 100644
--- a/mlir/lib/Analysis/Presburger/PWMAFunction.cpp
+++ b/mlir/lib/Analysis/Presburger/PWMAFunction.cpp
@@ -337,6 +337,9 @@ PWMAFunction PWMAFunction::unionFunction(
     PresburgerSet dom(pieceA.domain);
     for (const Piece &pieceB : func.pieces) {
       PresburgerSet better = tiebreak(pieceB, pieceA);
+      if (better.isIntegerEmpty())
+        continue;
+
       // Add the output of pieceB, where it is better than output of pieceA.
       // The disjuncts in "better" will be disjoint as tiebreak should gurantee
       // that.

``````````

</details>


https://github.com/llvm/llvm-project/pull/182468


More information about the Mlir-commits mailing list