<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 - failed assertion in Live Variable Analysis with callbr w/ outputs"
   href="https://bugs.llvm.org/show_bug.cgi?id=45565">45565</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>failed assertion in Live Variable Analysis with callbr w/ outputs
          </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>enhancement
          </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>ndesaulniers@google.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>efriedma@quicinc.com, isanbard@gmail.com, llvm-bugs@lists.llvm.org, srhines@google.com
          </td>
        </tr>

        <tr>
          <th>Blocks</th>
          <td>4068
          </td>
        </tr></table>
      <p>
        <div>
        <pre>llc -O2 futex.ll:

```
@c = dso_local local_unnamed_addr global i32 0, align 4                         
@a = dso_local local_unnamed_addr global i32 0, align 4

define dso_local i32 @b(i32* nocapture %f) #0 {
entry:
  %0 = callbr i32 asm "", "=r,X,~{dirflag},~{fpsr},~{flags}"(i8*
blockaddress(@b, %e))
          to label %asm.fallthrough [label %e]

asm.fallthrough:                                  ; preds = %entry
  store i32 %0, i32* %f, align 4
  br label %e

e:                                                ; preds = %asm.fallthrough,
%entry
  ret i32 undef
}

define dso_local i32 @futex_lock_pi_atomic() local_unnamed_addr {
entry:
  %0 = callbr i32 asm "", "=r,X,~{dirflag},~{fpsr},~{flags}"(i8*
blockaddress(@futex_lock_pi_atomic, %b.exit)) #2
          to label %asm.fallthrough.i [label %b.exit]

asm.fallthrough.i:                                ; preds = %entry
  br label %b.exit

b.exit:                                           ; preds = %entry,
%asm.fallthrough.i
  %1 = load i32, i32* @c, align 4
  %2 = tail call { i32, i32 } asm "",
"=r,={ax},1,0,~{dirflag},~{fpsr},~{flags}"(i32 %0, i32 %1)
  %asmresult = extractvalue { i32, i32 } %2, 0
  %asmresult1 = extractvalue { i32, i32 } %2, 1
  store i32 %asmresult, i32* @c, align 4
  store i32 %asmresult1, i32* @a, align 4
  ret i32 undef
}
```

llc: ../lib/CodeGen/LiveVariables.cpp:114: void
llvm::LiveVariables::MarkVirtRegAliveInBlock(llvm::LiveVariables::VarInfo &,
llvm::MachineBasicBlock *, llvm::MachineBasicBlock *,
std::vector<MachineBasicBlock *> &): Assertion `MBB != &MF->front() && "Can't
find reaching def for virtreg"' failed.
1.      Running pass 'Function Pass Manager' on module 'futex.ll'.
2.      Running pass 'Live Variable Analysis' on function
'@futex_lock_pi_atomic'
...
 #9 0x00000000035d4d1e llvm::LiveVariables::HandleVirtRegUse(unsigned int,
llvm::MachineBasicBlock*, llvm::MachineInstr&)
(/android0/llvm-project/llvm/build/bin/llc+0x35d4d1e)
#10 0x00000000035d746e llvm::LiveVariables::runOnInstr(llvm::MachineInstr&,
llvm::SmallVectorImpl<unsigned int>&)
(/android0/llvm-project/llvm/build/bin/llc+0x35d746e)
#11 0x00000000035d7a4c
llvm::LiveVariables::runOnBlock(llvm::MachineBasicBlock*, unsigned int)
(/android0/llvm-project/llvm/build/bin/llc+0x35d7a4c)
#12 0x00000000035d82a1
llvm::LiveVariables::runOnMachineFunction(llvm::MachineFunction&)
(/android0/llvm-project/llvm/build/bin/llc+0x35d82a1)
#13 0x000000000363fd0a
llvm::MachineFunctionPass::runOnFunction(llvm::Function&)
(/android0/llvm-project/llvm/build/bin/llc+0x363fd0a)
#14 0x0000000003a1cc74 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/android0/llvm-project/llvm/build/bin/llc+0x3a1cc74)
#15 0x0000000003a1cf28 llvm::FPPassManager::runOnModule(llvm::Module&)
(/android0/llvm-project/llvm/build/bin/llc+0x3a1cf28)
#16 0x0000000003a1d57d llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/android0/llvm-project/llvm/build/bin/llc+0x3a1d57d)
#17 0x00000000022b9618 main
(/android0/llvm-project/llvm/build/bin/llc+0x22b9618)
...</pre>
        </div>
      </p>

        <div id="referenced">
          <hr style="border: 1px dashed #969696">
          <b>Referenced Bugs:</b>
          <ul>
              <li>
                [<a class="bz_bug_link 
          bz_status_CONFIRMED "
   title="CONFIRMED - [Meta] Compiling the Linux kernel with clang"
   href="https://bugs.llvm.org/show_bug.cgi?id=4068">Bug 4068</a>] [Meta] Compiling the Linux kernel with clang
              </li>
          </ul>
        </div>
        <br>

      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>