[Mlir-commits] [mlir] [mlir][nfc] Minor cleanups in DeadCodeAnalysis (PR #159232)

Zhixun Tan llvmlistbot at llvm.org
Wed Sep 17 10:03:50 PDT 2025


phisiart wrote:

> Seems reasonable to me.
> 
> The NFC aspect is bordeline though: can't this be observed by some other analysis? Can't the liveness be queried by program points?

Agreed that this NFC is borderline. It is true that this is observable by some other analysis, but on the other hand, the existing behavior (i.e. before this PR) is buggy:

* In `visitRegionBranchOperation()`, when we jump from before the `RegionBranchOpInterface` to after the `RegionBranchOpInterface` (i.e. skipping any region), we mark the program point after the `RegionBranchOpInterface` as executable;

* In `visitRegionTerminator()`, when we jump from the end of some region to after the `RegionBranchOpInterface` (i.e. jump out), we don't mark the program point after the `RegionBranchOpInterface` as executable.

There is no good reason for this discrepancy anyway, so in that sense, this PR either fixes a subtle bug, or is truly NFC.

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


More information about the Mlir-commits mailing list