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

    <tr>
        <th>Summary</th>
        <td>
            R600ControlFlowFinalizer::MakeALUClause: ALU clause is too big (crash, regression)
        </td>
    </tr>

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

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

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

<pre>
    I built very recent LLVM  and Mesa for OpenCL purpose on Ubuntu 20.04.4 focal, precisely the 68f87acd57d7b4e0a20402e03634573b816e6425 commit of LLVM and [`e858da3`](https://gitlab.freedesktop.org/mesa/mesa/-/commit/e858da39e54ed34712ae044d80bcc23c398b53f3) commit of Mesa using my [`user-mesa`](https://gitlab.com/illwieckz/i-love-compute/-/blob/master/scripts/user-mesa) build script from the “_I ♥ Compute_” repository.

When running [Luxmark 3.1](http://wiki.luxcorerender.org/LuxMark_v3#Binaries) OpenCL benchmark, I got this crash:

> ```luxmark.bin: ~/dev/i-love-compute/scripts/workspace/user-mesa/llvm-project/llvm/lib/Target/AMDGPU/R600ControlFlowFinalizer.cpp:433: (anonymous namespace)::R600ControlFlowFinalizer::ClauseFile (anonymous namespace)::R600ControlFlowFinalizer::MakeALUClause(llvm::MachineBasicBlock &, MachineBasicBlock::iterator &) const: Assertion `ClauseContent.size() < 128 && "ALU clause is too big"' failed.```

I reproduced the issue with those TeraScale 3 GPUs:

- AMD Radeon HD 6990 RV970 Antilles XT (dual gpu variant of the 6970);
- AMD Radeon HD 6970 RV970 Cayman XT.

This is a regression as it works with older LLVM 9.0.1 and Mesa 9.0.1: http://luxmark.info/node/9355 (completed benchmark run on the exact same computer and installation, but running old builds of Mesa and LLVM instead).

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJylVU1v4zYQ_TXyZWBBpr4PPjh20gZI0CJNdnsLKGp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