[Mlir-commits] [mlir] [mlir][gpu] Fix crash in RemoveDeadValues pass with gpu.launch ops (PR #182711)

Matthias Springer llvmlistbot at llvm.org
Mon Feb 23 00:40:48 PST 2026


================
@@ -237,6 +238,12 @@ RunLivenessAnalysis::RunLivenessAnalysis(Operation *op) {
         for (auto blockArg : llvm::enumerate(block.getArguments())) {
           if (getLiveness(blockArg.value()))
             continue;
+          // Skip block args of ops with regions that are not
+          // RegionBranchOpInterface or FunctionOpInterface
+          // (e.g. gpu.launch) - solver doesn't analyze their regions
+          if (!isa<RegionBranchOpInterface>(op) &&
----------------
matthias-springer wrote:

I ran the test case with `-test-liveness-analysis` and it shows all block arguments as dead.

This looks correct to me wrt. to the definition of liveness:
```c++
//===----------------------------------------------------------------------===//
// LivenessAnalysis
//===----------------------------------------------------------------------===//

/// For every value, liveness analysis determines whether or not it is "live".
///
/// A value is considered "live" iff it:
///   (1) has memory effects OR
///   (2) is returned by a public function OR
///   (3) is used to compute a value of type (1) or (2) OR
///   (4) is returned by a return-like op whose parent isn't a callable
///       nor a RegionBranchOpInterface (e.g.: linalg.yield, gpu.yield,...)
///       These ops have their own semantics, so we conservatively mark the
///       the yield value as live.
/// It is also to be noted that a value could be of multiple types (1/2/3) at
/// the same time.
///
```


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


More information about the Mlir-commits mailing list