<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 - "Using an undefined physical register" error after creating bundle"
   href="https://bugs.llvm.org/show_bug.cgi?id=52107">52107</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>"Using an undefined physical register" error after creating bundle
          </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>Windows NT
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>Common Code Generator Code
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>john.brawn@arm.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Compiling the following:

  define double @fn(i32* %p, float* %q) {
  entry:
    %0 = load i32, i32* %p, align 4
    %cmp = icmp eq i32 %0, 0
    br i1 %cmp, label %if.then, label %if.end

  if.then:
    %1 = load float, float* %q, align 4
    %conv = fpext float %1 to double
    ret double %conv

  if.end:
    call void @unreachable()
    unreachable
  }

  declare void @unreachable() local_unnamed_addr #0
  attributes #0 = { noreturn }

with llc -mtriple=thumbv7-unknown-linux-gnueabihf -verify-machineinstrs tmp.ll
gives the error

*** Bad machine code: Using an undefined physical register ***
- function:    fn
- basic block: %bb.0 entry (0x856788)
- instruction: frame-destroy BUNDLE implicit-def dead $itstate, implicit-def
dead $s0, implicit-def dead $d0, implicit-def $s1, implicit-def $sp,
implicit-def $r7, implicit-def $pc, implicit killed $r1, implicit killed $cpsr,
implicit killed $d0, implicit $sp
- operand 9:   implicit killed $d0

*** Bad machine code: Using an undefined physical register ***
- function:    fn
- basic block: %bb.0 entry (0x856788)
- instruction: renamable $d0 = VCVTDS internal killed renamable $s0, 0, $cpsr,
implicit killed $d0, implicit internal $itstate
- operand 4:   implicit killed $d0

>From a brief look it seems like llvm::finalizeBundle is doing something wrong
when adding the register operands to the BUNDLE, as it has d0 being implicitly
read and killed but d0 only becomes live and then killed within the BUNDLE.</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>