<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 --- - [thumbv8] assertions fails when check for eligibility of IT block"
   href="http://llvm.org/bugs/show_bug.cgi?id=18368">18368</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[thumbv8] assertions fails when check for eligibility of IT block
          </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>Windows NT
          </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>weimingz@codeaurora.org
          </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>@foo = global i32 ()* null
define i32 @t4(i32 %x, i32 ()* %p_foo) {
entry:
;CHECK-LABEL: t4:
;CHECK-V8-LABEL: t4:
  %cmp = icmp slt i32 %x, 60
  br i1 %cmp, label %if.then, label %if.else

if.then:                                          ; preds = %entry
  %tmp.2 = call i32 %p_foo()
  %sub = add nsw i32 %x, -1
  br label %return

if.else:                                          ; preds = %entry
  %sub1 = add nsw i32 %x, -120
  br label %return

return:                                           ; preds = %if.end5,
%if.then4, %if.then
  %retval.0 = phi i32 [ %sub, %if.then ], [ %sub1, %if.else ]
  ret i32 %retval.0
}


The above test fails when run with llc -mtriple=thumbv8

Reason:
When it attempts to check if the operand of blx is valid
for IT block, the reg should be the 3rd MOOperand. E.g.:
blx r8:
@ <MCInst #2747 tBLXr
@ <MCOperand Imm:14>
@ <MCOperand Reg:0>
@ <MCOperand Reg:74> ==> this is the operand to be checked
>

However, the default value is 0:
inline boolq(InstrType *Instr, int BLXOperandIndex = 0)

There are 2 call sites:
ARMBaseInstrInfo.cpp:      return isV8EligibleForIT(MI); ==> this one is
causing the assertion
AsmParser/ARMAsmParser.cpp:          !isV8EligibleForIT(&Inst, 2)) {</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>