<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 - X86 isel crashes when generating AVX code"
   href="https://bugs.llvm.org/show_bug.cgi?id=51133">51133</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>X86 isel crashes when generating AVX code
          </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>jeremy.morse.llvm@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>andrea.dibiagio@gmail.com, craig.topper@gmail.com, llvm-bugs@lists.llvm.org, llvm-dev@redking.me.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Using a recent main (bad3ebbaae3d) build of llc, the following code makes llc
crash in SelectionDAG with arguments `llc reduced.ll -o /dev/null
-mtriple=x86_64-- -mattr=avx`:

define hidden void @_Z1dv() local_unnamed_addr {
entry:
  %call = tail call <32 x i8> undef(<32 x i8> undef, i32 32)
  %rem = srem <32 x i8> %call, <i8 13, i8 5, i8 19, i8 34, i8 2, i8 8, i8 2, i8
88, i8 62, i8 62, i8 5, i8 7, i8 97, i8 2, i8 3, i8 60, i8 3, i8 87, i8 7, i8
6, i8 84, i8 -128, i8 127, i8 56, i8 114, i8 1, i8 50, i8 7, i8 2, i8 8, i8 97,
i8 117>
  %k.0.k.0.k.0. = load volatile <8 x i32>, <8 x i32>* undef, align 32
  %0 = bitcast <8 x i32> %k.0.k.0.k.0. to <32 x i8>
  %cmp = icmp ne <32 x i8> %rem, zeroinitializer
  %cmp4 = icmp ne <32 x i8> %0, zeroinitializer
  %1 = and <32 x i1> %cmp4, %cmp
  %sext = sext <32 x i1> %1 to <32 x i8>
  %call5 = tail call i32 (i8*, ...) undef(i8* poison, <32 x i8> %sext)
  ret void
}

The crash is an assertion failure:

SelectionDAG.cpp:9016: void llvm::SelectionDAG::ReplaceAllUsesWith(llvm::SDNode
*, llvm::SDNode *): Assertion `(!From->hasAnyUseOfValue(i) ||
From->getValueType(i) == To->getValueType(i)) && "Cannot use this version of
ReplaceAllUsesWith!"' failed

It doesn't replicate if you remove -mattr=avx. I have a C reproducer (involving
some intrinsics) of this if that's more useful.</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>