<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Using -exhaustive-register-search may lead to assert (RAGreedy)"
   href="https://bugs.llvm.org/show_bug.cgi?id=38062">38062</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Using -exhaustive-register-search may lead to assert (RAGreedy)
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>verena@codeplay.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>When using the option -exhaustive-register-search and a low (or default) value
of -lcr-max-interf you may get the assertion `(i == Size || Traits::stopLess(b,
start(i))) && "Overlapping insert".
This is due to RAGreedy::mayRecolorAllInterferences:

    if (Q.collectInterferingVRegs(LastChanceRecoloringMaxInterference) >=
        LastChanceRecoloringMaxInterference && !ExhaustiveSearch) {
      DEBUG(dbgs() << "Early abort: too many interferences.\n");
      CutOffInfo |= CO_Interf;
      return false;
    }
    for (unsigned i = Q.interferingVRegs().size(); i; --i) {
      ...

If ExhaustiveSearch is set then we loop through the interfering registers to
recolour them. But if LastChanceRecoloringMaxInterference is set to a number
lower than the actual number of interferences then we only process (deallocate)
a subset. When we then allocate the original interval we have introduced an
illegal overlap.

I feel -exhaustive-register-search should imply -lcr-max-interf=inf or at least
print a useful error message. I'm guessing without assertions enabled this
might just lead to wrong codegen.

I'm afraid my target is custom, so I can't provide a test case.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>