<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </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 --- - [TableGen] Register Pressure information is wrong for x86"
   href="https://llvm.org/bugs/show_bug.cgi?id=23423">23423</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[TableGen] Register Pressure information is wrong for x86
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>tools
          </td>
        </tr>

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

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

        <tr>
          <th>OS</th>
          <td>All
          </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>TableGen
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>qcolombet@apple.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>While helping Daniel Jasper for <a href="http://reviews.llvm.org/D8998">http://reviews.llvm.org/D8998</a>, which teach
MachineLICM how to deal with register masks to make it register pressure aware,
I found a bug in the tables that describe the register pressure.

The bug appears only when we have partially defined register aliasing patterns.
I.e., given a register class RC, some of the registers in RC do not have the
same number of register unit.

E.g., on X86, we have:
AX = AH AL
but
R8W = R8B

I am not exactly sure why it happens, but because of that difference, table gen
creates fake reg units that do not increase the number of available unit for
each register class, but that are not accessible. Therefore, we have less
available space than we actually think when doing the analysis.

E.g., the previous example becomes:
AX = AH AL
but
R8W = N/A R8B

Where N/A is not accessible. Now a regclass with both AX and R8W would give 4
as register limit instead of 3.

* STEPS TO REPRODUCE
<llvm_build>/Debug+Asserts/bin/llvm-tblgen -I <llvm_src>/lib/Target/X86 -I
<llvm_src>/include -I <llvm_src>/include -I <llvm_src>/lib/Target
-gen-register-info -o
<llvm_build>/lib/Target/X86/Debug+Asserts/X86GenRegisterInfo.inc.tmp
<llvm_src>/lib/Target/X86/X86.td -debug-only=regalloc-emitter

* RESULTS
Because of those ghost reg unit tablegen will segfault because it tries to
print the name of something that does not exist.</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>