[Mlir-commits] [mlir] [mlir][Transforms] Fix crash in `-remove-dead-values` on private functions (PR #169269)

lonely eagle llvmlistbot at llvm.org
Sun Nov 23 19:28:57 PST 2025


================
@@ -141,6 +141,33 @@ static bool hasLive(ValueRange values, const DenseSet<Value> &nonLiveSet,
   return false;
 }
 
+/// Return true iff at least one value in `values` is dead, given the liveness
+/// information in `la`.
+static bool hasDead(ValueRange values, const DenseSet<Value> &nonLiveSet,
+                    RunLivenessAnalysis &la) {
+  for (Value value : values) {
+    if (nonLiveSet.contains(value)) {
+      LDBG() << "Value " << value << " is already marked non-live (dead)";
+      return true;
+    }
+
+    const Liveness *liveness = la.getLiveness(value);
+    if (!liveness) {
----------------
linuxlonelyeagle wrote:

https://github.com/llvm/llvm-project/blob/acab67baa72c9def53ac8fcd57cbb3b386903405/mlir/lib/Analysis/DataFlow/LivenessAnalysis.cpp#L350

Perhaps such a situation does not exist.

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


More information about the Mlir-commits mailing list