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

    <tr>
        <th>Summary</th>
        <td>
            [LLVM][SLSR] Add a debug counter
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            good first issue,
            llvm
      </td>
    </tr>

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

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

<pre>
    Add a debug counter to selectively enable or disable SLSR transformations. The debug counter should wrap `SLSR`'s invocation of [rewriteCandidateWithBasis()](https://github.com/llvm/llvm-project/blob/bd40421ad9ec5ecc164f8208caf3ba5657977e17/llvm/lib/Transforms/Scalar/StraightLineStrengthReduce.cpp#L693C7-L693C32).

---

See [DAGCombiner.cpp](https://github.com/llvm/llvm-project/blob/bd40421ad9ec5ecc164f8208caf3ba5657977e17/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp#L2025-L2026) for an example use case for a debug counter:
```
SDValue DAGCombiner::combine(SDNode *N) {
  if (!DebugCounter::shouldExecute(DAGCombineCounter))
      return SDValue();
 ...
```

See 7a8dc3dafa85a1bbbb9458f2162ac5d61a9dc91a for an example of a patch that adds support for a debug counter. 

---

Don't feel the need to ask permission to work on this. Just give it a try! 

CC @akshayrdeodhar
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzEVMGOpDgM_ZrUxSoUDBRw4EBXbbW0qp3D1Gj2bBIDmaYISkL39N-vQnWrZ1tz2dOiiBgUP9vx8yPvzTAzN6J4EMVpR2sYrWt-rD6YuSc3zHYyu87q16bVGgg0d-sAyq5zYAfBgueJVTDPPL0Cz9RNDNaBNn4zr5frVwiOZt9bd6Ng7OwT-DbyJyA_2nXS8OJoAXGQ0U0cpMDSg5mfrdo8wfYgigfHL84EPtKsjabAf5swPpA3XmAlsBbFSWA1hrB4kbUCzwLPgwnj2iXK3gSep-n5fd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