<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_NEW "
   title="NEW --- - llc aborts on testcase"
   href="http://llvm.org/bugs/show_bug.cgi?id=17868">17868</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>llc aborts on testcase
          </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>NEW
          </td>
        </tr>

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

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

        <tr>
          <th>Component</th>
          <td>Loop Optimizer
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>vargaz@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=11505" name="attach_11505" title="testcase">attachment 11505</a> <a href="attachment.cgi?id=11505&action=edit" title="testcase">[details]</a></span>
testcase

llc aborts with the following on the attached testcase:

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Instruction does not dominate all uses!
  %1 = add i64 %0, 1
  %lsr = trunc i64 %1 to i32
Broken module found, compilation aborted!
<span class="quote">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>></span >

LLVM version: svn r194345
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
LLVM (<a href="http://llvm.org/">http://llvm.org/</a>):
  LLVM version 3.4svn
  DEBUG build with assertions.
  Built Nov  8 2013 (23:07:17).
  Default target: x86_64-apple-darwin13.0.0
  Host CPU: corei7-avx

  Registered Targets:
    aarch64 - AArch64 (ARM 64-bit target)
    arm     - ARM
    thumb   - Thumb
    x86     - 32-bit X86: Pentium-Pro and above
    x86-64  - 64-bit X86: EM64T and AMD64
<span class="quote">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>></span >
llc command line: llc bug.bc

It looks like the problem is introduced by the loop-reduce pass,
i.e.: llc -stop-after=loop-reduce -print-after-all shows:
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
*** IR Dump After Print module to stderr ***; ModuleID = 'y.bc'
target triple = "x86_64-apple-darwin13.0.0"

define void @FOO() {
BB0:
  br label %BB1

BB1:                                              ; preds = %BB9, %BB0
  %0 = sext i32 undef to i64
  br i1 undef, label %BB5.preheader, label %BB9

BB5.preheader:                                    ; preds = %BB1
  br label %BB5

BB5:                                              ; preds = %BB5.preheader,
%BB6
  %indvars.iv = phi i64 [ %indvars.iv.next.pre-phi, %BB6 ], [ %0,
%BB5.preheader ]
  %lsr1 = trunc i64 %indvars.iv to i32
  %lsr = trunc i64 %indvars.iv.next.pre-phi to i32
  %1 = add i64 %indvars.iv, 1
  %.pre = trunc i64 %1 to i32
  br i1 undef, label %BB7, label %BB6
.....
<span class="quote">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>></span >
At this line:
%lsr = trunc i64 %indvars.iv.next.pre-phi to i32

indvars.iv.next.pre-phi is not set when control goes
BB0->BB1->BB5.preheader->BB5.</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>