<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_ASSIGNED "
   title="ASSIGNED --- - [AArch64] Address Type Promotion - Assertion `use_empty() && "Uses remain when a value is destroyed!"' failed."
   href="http://llvm.org/bugs/show_bug.cgi?id=20188">20188</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[AArch64] Address Type Promotion - Assertion `use_empty() && "Uses remain when a value is destroyed!"' failed.
          </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>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>ASSIGNED
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>Backend: AArch64
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>dexonsmith@apple.com
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>mcrosier@codeaurora.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>apazos@codeaurora.org, llvmbugs@cs.uiuc.edu, t.p.northover@gmail.com, zhaoshiz@codeaurora.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I believe this was introduced in one of these two commits:
<a href="http://llvm.org/viewvc/llvm-project?view=revision&revision=212073">http://llvm.org/viewvc/llvm-project?view=revision&revision=212073</a>
<a href="http://llvm.org/viewvc/llvm-project?view=revision&revision=212075">http://llvm.org/viewvc/llvm-project?view=revision&revision=212075</a>

Reproduce with:
llc -O3 -mcpu=cortex-a53 -mtriple=aarch64--linux-gnu
bugpoint-reduced-simplified.ll

Testcase:

define void @foo() unnamed_addr align 2 {
entry:
  br label %invoke.cont145

invoke.cont145:
  %or.cond = and i1 undef, false
  br i1 %or.cond, label %if.then274, label %invoke.cont145

if.then274:
  %0 = load i32* null, align 4
  br i1 undef, label %invoke.cont291, label %if.else313

invoke.cont291:
  %idxprom.i.i.i605 = sext i32 %0 to i64
  %arrayidx.i.i.i607 = getelementptr inbounds double* undef, i64
%idxprom.i.i.i605
  %idxprom.i.i.i596 = sext i32 %0 to i64
  %arrayidx.i.i.i598 = getelementptr inbounds double* undef, i64
%idxprom.i.i.i596
  br label %if.end356

if.else313:
  %cmp314 = fcmp olt double undef, 0.000000e+00
  br i1 %cmp314, label %invoke.cont317, label %invoke.cont353

invoke.cont317:
  br i1 undef, label %invoke.cont326, label %invoke.cont334

invoke.cont326:
  %idxprom.i.i.i587 = sext i32 %0 to i64
  %arrayidx.i.i.i589 = getelementptr inbounds double* undef, i64
%idxprom.i.i.i587
  %sub329 = fsub fast double undef, undef
  br label %invoke.cont334

invoke.cont334:
  %lo.1 = phi double [ %sub329, %invoke.cont326 ], [ undef, %invoke.cont317 ]
  br i1 undef, label %invoke.cont342, label %if.end356

invoke.cont342:
  %idxprom.i.i.i578 = sext i32 %0 to i64
  %arrayidx.i.i.i580 = getelementptr inbounds double* undef, i64
%idxprom.i.i.i578
  br label %if.end356

invoke.cont353:
  %idxprom.i.i.i572 = sext i32 %0 to i64
  %arrayidx.i.i.i574 = getelementptr inbounds double* undef, i64
%idxprom.i.i.i572
  br label %if.end356

if.end356:
  %lo.2 = phi double [ 0.000000e+00, %invoke.cont291 ], [ %lo.1,
%invoke.cont342 ], [ undef, %invoke.cont353 ], [ %lo.1, %invoke.cont334 ]
  call void null(i32 %0, double %lo.2)
  unreachable
}</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>