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

Yue Huang llvmlistbot at llvm.org
Fri Feb 20 02:23:05 PST 2026


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

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

>From d688879a1404ed973834d2a7855fae5f4fd7428b Mon Sep 17 00:00:00 2001
From: Yue Huang <yh548 at cam.ac.uk>
Date: Fri, 20 Feb 2026 10:20:30 +0000
Subject: [PATCH] [MLIR][Presburger][NFC] Don't add empty regions when unioning
 PWMA functions

---
 mlir/lib/Analysis/Presburger/PWMAFunction.cpp | 3 +++
 1 file changed, 3 insertions(+)

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.



More information about the Mlir-commits mailing list