<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 - llvm-stress crashes DAG.getLoad()"
   href="https://bugs.llvm.org/show_bug.cgi?id=32505">32505</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>llvm-stress crashes DAG.getLoad()
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </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>enhancement
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>Common Code Generator Code
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>paulsson@linux.vnet.ibm.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=18213" name="attach_18213" title="reduced test case">attachment 18213</a> <a href="attachment.cgi?id=18213&action=edit" title="reduced test case">[details]</a></span>
reduced test case

A small nonsense function looks like:

Optimized type-legalized selection DAG: BB#0 'autogen_SD5046:CF265'
SelectionDAG has 9 nodes:
  t0: ch = EntryToken
    t27: i32,ch = load<LD1[undef+1], sext from i8> t0, undef:i64, undef:i64
  t22: f32 = bitcast t27
    t11: ch = CopyToReg t0, Register:f32 %vreg0, t22
    t13: ch = CopyToReg t0, Register:f32 %vreg1, t22
  t14: ch = TokenFactor t11, t13

SystemZTargetLowering::lowerBITCAST() calls DAG.getLoad() in the first if
statement.

This causes an assert to trigger:
assert(memvt.getStoreSize() <= MMO->getSize() && "Size mismatch!");

The problem here is that memvt.getStoreSize()==4, while MMO->getSize()==1.
The load which has the 'sext from i8' flag, while it is only loading one byte.

How should this be handled? Should the load be expanded into load+sext somehow
in the SystemZ method instead of calling getLoad() directly?

Run with
llc -mtriple=s390x-linux-gnu -mcpu=zEC12 ./stress_fail_bitcast_load.ll</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>