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

    <tr>
        <th>Summary</th>
        <td>
            [Instcombine] Excessive folding causes isel to crash
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            llvm:optimizations
      </td>
    </tr>

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

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

<pre>
    [testcase.tar.gz](https://github.com/llvm/llvm-project/files/8599031/testcase.tar.gz)

clang -O3 -target s390x-linux-gnu -march=arch13 crash3_aftercreduce.c -o a.out -mllvm -unroll-allow-remainder=false -mllvm -unroll-count=10

After the unrolling, there are a very great number of xor instructions, but instcombiner combines them all into a collossall xor with xor expressions, which seems to be too much for SelectionDAGBuilder.

Maybe there should be a limit to how many folded expressions instcombine produces, so that this does not become a problem?

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyVklFv2yAQxz-N_YJs2RDH8YMf0mWdNmnapH2ACeOzzYQh4qBJ-ul3uK0a9a2SzQF3_PjfcYMbb33WPATAoCRCGaQv5-esOWX8sIRwxkwcM_5I36zDEodSuZUWxjy9meLs3T9QgZaTNoBkD03XVaKm2Ucu77LqlFXHl1EZaWdW_BKsIP8MgaHoqmthtI3XYraRFav0asnEKZlaMOUlLuKvnAJ45WGMCkrFCsdk6WKg8KSIFdF6Z0whjXGXwsMqtR3BE2aSBuFjmHLRBnLW1b24Y7qDhQXYS5i2c8a_pA0PTKafPYG_sdmDDMzGdaBwN7Gr80xbDD6qoJ3FdGggbWmPijdoS3GvE0y4lZFOcgfKghykGTHtJNCFir5N4Hr2gPgGvCxaLQwBVkI4NgCNjq2RNieK_gMGtttPx28PURtKvrzP7ae8pSNbKri4aMaEkMzoVYcEXNyFrdLeiEaHx_vr7xNh9PbpDTZN6IhIpQiLRjY6Ss66QFyKTWwKHQysmXh80ZCPvRg70ck86GAgdeH3dzJ1IPt6VenOJ9hUUP2ZkhGJqxFMUrl1Qx696T_dqhoxbr3aNLzq8qU_8Gqn2rrbgyBTi6aRrdzXh327b8f9HnIjBzCYZGacb1BxdOdAFXuWrw_NSXWue15xXjUVQXZc8HIndrJpleR1Wx-mqc12VepIUyZI6fyc-35TN8QZyWk0Bnx3SirBbGErUOLLGBbn-x_O_kZ0Nt8y6bc0_gPY3Egh">