<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 - After r299770, Assertion failed: (New->getType() == getType() && "replaceAllUses of value with new value of different type!"), function doRAUW, file lib/IR/Value.cpp, line 375."
   href="https://bugs.llvm.org/show_bug.cgi?id=36116">36116</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>After r299770, Assertion failed: (New->getType() == getType() && "replaceAllUses of value with new value of different type!"), function doRAUW, file lib/IR/Value.cpp, line 375.
          </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>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>new bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>dimitry@andric.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>As reported in <a href="https://bugs.freebsd.org/225471">https://bugs.freebsd.org/225471</a>, building the FreeBSD
emulators/snes9x port for x86_64 with clang 6.0.0 results in an assertion:

Assertion failed: (New->getType() == getType() && "replaceAllUses of value with
new value of different type!"), function doRAUW, file
/poudriere/jails/head-amd64/usr/src/contrib/llvm/lib/IR/Value.cpp, line 404.

This assertion still occurs with trunk r322755, and bisection shows it has
regressed with <a href="http://reviews.llvm.org/rL299770">http://reviews.llvm.org/rL299770</a> ("Reapply r298620: [LV]
Vectorize GEPs") by Matthew Simpson.  (Which was a reapplication of
<a href="https://reviews.llvm.org/rL298620">https://reviews.llvm.org/rL298620</a>.)

Minimized test case:

// clang -cc1 -triple x86_64 -S -O2 -vectorize-loops fxemu-minimized.cpp
struct {
  unsigned char *a[];
} b;
unsigned char c;
int d;
void e() {
  d = 0;
  for (; d < 32; d++)
    b.a[d] = &c + ((d & 16) << 1);
}

Note that -vectorize-loops is essential for reproducing the assertion.

As far as I can see, this is *not* a duplicate of <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED FIXED - clang crashes on valid code at -O2 and -O3 on x86_64-linux-gnu: Assertion `New->getType() == getType() && "replaceAllUses of value with new value of different type!"' failed"
   href="show_bug.cgi?id=27969">bug 27969</a>, <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED FIXED - Assertion `New->getType() == getType() && "replaceAllUses of value with new value of different type!"' failed"
   href="show_bug.cgi?id=30783">bug 30783</a>, bug
34783 or <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED FIXED - clang crashes on valid code at -O2 and -O3 on x86_64-linux-gnu: Assertion `New->getType() == getType() && "replaceAllUses of value with new value of different type!"' failed"
   href="show_bug.cgi?id=34759">bug 34759</a>, as those are all resolved, and this assertion still occurs
as of 2018-01-27.</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>