<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 - [amdgpu] rL343329: [InstCombine] don't propagate wider shufflevector arguments to predecessors cause regression in storing char3 vectors"
   href="https://bugs.llvm.org/show_bug.cgi?id=39132">39132</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[amdgpu]  rL343329: [InstCombine] don't propagate wider shufflevector arguments to predecessors cause regression in storing char3 vectors
          </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>Backend: AMDGPU
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>jan.vesely@rutgers.edu
          </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=20942" name="attach_20942" title="piglit test that fails">attachment 20942</a> <a href="attachment.cgi?id=20942&action=edit" title="piglit test that fails">[details]</a></span>
piglit test that fails

this change introduces failures when loading/storing char3 vectors in
OpenCL (amdgcn backend):
llc: /home/orome/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:4159:
llvm::SDValue llvm::SelectionDAG::getNode(unsigned int, const
llvm::SDLoc&, llvm::EVT, llvm::SDValue, llvm::SDNodeFlags): Assertion
`VT.getSizeInBits() == Operand.getValueSizeInBits() && "Cannot BITCAST
between types of different sizes!"' failed.
Stack dump:
0.      Program arguments: /home/orome/.local/bin/llc -march=amdgcn 
1.      Running pass 'CallGraph Pass Manager' on module '<stdin>'.
2.      Running pass 'AMDGPU DAG->DAG Pattern Instruction Selection'
on function '@vload3_constant'

the patch changes how char3 vector is constructed. instead of starting
with <4xi8> (edited):

  %3 = insertelement <4 x i8> undef, i8 %2, i32 0
  %5 = insertelement <4 x i8> %3, i8 %4, i32 1
  %7 = insertelement <4 x i8> %5, i8 %6, i32 2
  store <4 x i8> %7, <4 x i8> addrspace(1)* %storetmp, align 4, !tbaa !11

it creates <3 x i8>, which is then shuffled into another <3 x i8>, which is
then bitcast to <4 x i8>:

  %vecinit.i = insertelement <3 x i8> undef, i8 %2, i32 0
  %vecinit1.i = insertelement <3 x i8> %vecinit.i, i8 %3, i32 1
  %vecinit4.i = insertelement <3 x i8> %vecinit1.i, i8 %4, i32 2

  %extractVec = shufflevector <3 x i8> %vecinit4.i, <3 x i8> undef, <4 x i32>
<i32 0, i32 1, i32 2, i32 undef>

  %storetmp = bitcast <3 x i8> addrspace(1)* %out to <4 x i8> addrspace(1)*
  ^^^ I originally claimed that this one fails, but it's a pointer cast so it
really shouldn't
  store <4 x i8> %extractVec, <4 x i8> addrspace(1)* %storetmp, align 4, !tbaa
!11

the attached .cl file will need libclc</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>