<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/64139>64139</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Error in the sparse backward dataflow analysis
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          srishti-pm
      </td>
    </tr>
</table>

<pre>
    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 is in 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 <srishtisrivastava.cs@gmail.com>
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMVc2O2zoPfRplQyTw2Gl-Fl7MTwfo6gO-9gVoi47VkSVfkUo6b38hWZNMBrhAN3EgizyHPIc0MpuTI2rVtyf17WWFUUYfWg6GRzHreVp1Xr-3zzEEcmLfVf0MxoGMBDxjYIIO-7cLBg0aBQfrL4AO7TsbTnfTIQzBTzkkEEcrrKoXVT36AdCBn8FMs6WJnBh3ArWr_k8n491TQNeP_5t_OKEwYE9qV4Fh6L1joymQBvGQAJd0xonPIH6mgE4z-AHoTOE9YciIAtoTg_NyQ0wBS_gX3F8UJuNQfPjCoIuSWASSGNzamjcCdBrmQExOPqgAQsjZEolEavBhor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