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

    <tr>
        <th>Summary</th>
        <td>
            [Flang][OpenMP] Implement robust lowering for Reduction
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            openmp,
            flang:ir
      </td>
    </tr>

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

    <tr>
      <th>Reporter</th>
      <td>
          kiranchandramohan
      </td>
    </tr>
</table>

<pre>
    The current method for lowering depends on detecting operation patterns in the generate FIR. This is problematic due to a few reasons,
-> The patterns differ for variables like pointers and allocatable.
-> Deleting operations with FIROpBuilder does not seem to be appropriate.

There are probably a few alternative ways in which Reductions can be lowered. One approach is to detect that an Assignment Statement implies a reduction and then lower the Assignment Statement in a different way. This is explored in https://reviews.llvm.org/D130601 but needs more work for completion.

Another possibility is to create separate parse-tree nodes or expression nodes to signify reduction.

It is also possible that the presence of higher level ops (https://reviews.llvm.org/D134285) might simplify this task.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyNVMGOmzAQ_Rq4jDYCEpJw4JBtGmkP1Vbb_QGDh-DG2Mg2SfP3fSbpbiP1UCnExva8efPmmcbKa_3eM7WTc2wCDRx6K6mzjrS9sFPmSJJHNtKTNZgGbkNctCM7ERTWRhECO-NJGQqAOrKJW0yHl7cFvfcKO55GZxvNA0JakhNTsCSo4ws5Ft4anxRfkmyfZLunZPmVIqUPXKm6jt3M6SycEsDxpNUJR6wyOONJGElCa9uKELcXf0HtWfMjY08XFfpI73V8npSWAJcWmMYG8sxDJNcwiRGkRyQMfwBv_yDnsIsnFoV813spQkfCyHFmuojrrMilV21Pbyyn9pa7FSaCz-qyXNCruWcSOAehkPumMsQUAZXRznt1NENsz48AMvNMDaNW4Cwg4B17VgEdMDfwuRn_jsXRu6rxFVQ_-8S_Rm0BGQ_1IYw-We6S4oCf47Pii19ofR4W1h2xtM-X2TrLqZkCGWZ4ZEAsXaw7ze1qLVhy5PYg4A5CQ0O0D-wapVW43itv4QY4x_MoZgth8PwUHDOaI1EuQMHQMQJR8G0NcbFI1V0_tXjI9xIivNDe3lNqvokbFYpgbFom21GvjpGX5jNr-MVTUmz_R4RVsS2ToqIB8bDQ3BuwCVHTIPxpkXKdr9dlVlbVtkxlvZTVshJpUEFznZTPBy3MMSn3mL7isn37jjm9RPHmhsFmkw-fNzJq-2GpdHK6fmR5hL-nZgH58RKp3ocn2OwnrIVX5f3EuHWHcptXWdrXm1UlWXC3kat1uWpEV3RtV22zJa831TrPUy0a1j6yTYoCl8kMIya4t1Cp6OYCljvl4lq5T1VdZEWRZ9k6L5bVqlzk622x6ZqqzFdVJWWRrDJ8DpT-kDJ19cyxmY4em1r58KlzKmYj86xWxBcTPlSuPiknTNvD-U4MFmM6F1bPVf0GeEer3A">