llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

Error in the sparse backward dataflow analysis

Open srishti-pm opened this issue 3 years ago • 3 comments

Currently, in the sparse backward dataflow analysis, data from the results of an op implementing RegionBranchOpInterface is considered to flow into the operands of every op that does not implement the RegionBranchTerminatorOpInterface but is return-like and present in a region of the former. It is thus also expected that the number of results of the former be equal to the number of operands in the latter.

This understanding of dataflow is incorrect and thus this expectation is also not justified. This incorrect understanding needs to be fixed.

These return-like ops should instead be handled just like the ops implementing the RegionBranchTerminatorOpInterface, which means that, if this op has a region A whose successors are regions B, C, and D, then data flows from the arguments (successor inputs) of B, C, and D to the corresponding successor operands of this op.

The above fix should also be propagated to liveness analysis that currently relies on the incorrect implementation of the sparse backward dataflow analysis framework and should correct some incorrect assumptions made in it.

Signed-off-by: Srishti Srivastava [email protected]

srishti-pm avatar Jul 26 '23 23:07 srishti-pm

@llvm/issue-subscribers-mlir

llvmbot avatar Jul 26 '23 23:07 llvmbot

Upstream patch under review: https://reviews.llvm.org/D156376

jcai19 avatar Jul 26 '23 23:07 jcai19

Patch submitted. Thus, closing the issue.

srishti-pm avatar Aug 14 '23 22:08 srishti-pm