llvm-project
0227b791 - [mlir][nfc] Minor cleanups in DeadCodeAnalysis (#159232)

Commit
88 days ago
[mlir][nfc] Minor cleanups in DeadCodeAnalysis (#159232) * Remove `getOperandValuesImpl` since its only used once. * Extract common logic from `DeadCodeAnalysis::visitRegion{BranchOperation,Terminator}` into a new function `DeadCodeAnalysis::visitRegionBranchEdges`. In particular, both functions do the following: * Detect live region branch edges (similar to CFGEdge); * For each edge, mark the successor program point as executable (so that subsequent program gets visited); * For each edge, store the information of the predecessor op and arguments (so that other analyses know what states to join into the successor program point). One caveat is that, before this PR, in `visitRegionTerminator`, the successor program point is only marked as live if it is the start of a block; after this PR, the successor program point is consistently marked as live regardless what it is, which makes the behavior equal to `visitBranchOperation`. This minor fix improves consistency, but at this point it is still NFC, because the rest of the dataflow analysis framework only cares about liveness at block level, and the liveness information in the middle of a block isn't read anyway. This probably will change once [early-exits](https://discourse.llvm.org/t/rfc-region-based-control-flow-with-early-exits-in-mlir/76998) are supported.
Author
Parents
Loading