<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 - [SCEV][LSR] Broken IR after LSR pass when compiling for armv8"
   href="https://bugs.llvm.org/show_bug.cgi?id=42436">42436</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[SCEV][LSR] Broken IR after LSR pass when compiling for armv8
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

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

        <tr>
          <th>Hardware</th>
          <td>All
          </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>Global Analyses
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>eleviant@accesssoftek.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=22161" name="attach_22161" title="reproducer">attachment 22161</a> <a href="attachment.cgi?id=22161&action=edit" title="reproducer">[details]</a></span>
reproducer

Compilation of large project for ARMv8 ended up with broken assembly code in 

vector<_Tp, _Allocator>::insert(const_iterator __position, _ForwardIterator
__first, _ForwardIterator __last)

I investigated the problem and it seems to be in loop-reduce pass which creates
'sub' binary operation with these operands:

%8 = ptrtoint i8* %7 to i32
...
%10 = ptrtoint i8* undef to i32
...
.preheader:
%120 = sub i32 %10, %8

which should result to zero, but is in fact undefined.

One can reproduce it using the attached IR file and running:
opt -S -loop-reduce insert.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>