[llvm-branch-commits] [mlir] [mlir][Transforms] Fix crash in `-remove-dead-values` on private functions (PR #169269)
Matthias Springer via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu Nov 27 22:06:26 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) {
----------------
matthias-springer wrote:
I removed the `hasDead` function (to keep the PR smaller) and instead rely on `markLives(values, nonLiveSet, la).flip().any()`, like in other places in this file.
https://github.com/llvm/llvm-project/pull/169269
More information about the llvm-branch-commits
mailing list