<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/59751>59751</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            LLVM IR computeInstrHeights crash
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          Sintendo
      </td>
    </tr>
</table>

<pre>
    https://godbolt.org/z/j7a6Mj9bM

The following LLVM IR crashes when compiled on the latest trunk and LLVM versions <= 10.

```
target triple = "arm64-apple-ios14.0.0"

define void @"func"(i32** swifterror %0) #0 {
  br label %thirtyeight

five:
  br label %UelOc2l.exit

common.ret:
 ret void

UelOc2l.exit:
  %a = getelementptr inbounds [754 x i8*], [754 x i8*]* undef, i32 undef, i32 undef
  %b = load i8*, i8** %a, align 8
  %c = bitcast i8* %b to void ()*
  call void %c()
  br label %common.ret

thirtythree:
  br i1 false, label %UelOc2l.exit, label %thirtythree

thirtyeight:
  br i1 undef, label %thirtyeight, label %thirtythree
}

attributes #0 = { noinline optnone "target-cpu"="apple-a7" }
```

```
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: /opt/compiler-explorer/clang-trunk/bin/llc -o /app/output.s -x86-asm-syntax=intel <source>
1.      Running pass 'Function Pass Manager' on module '<source>'.
2.      Running pass 'Machine InstCombiner' on function '@func'
 #0 0x00005600140f1edf llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-trunk/bin/llc+0x32e4edf)
 #1 0x00005600140ef954 SignalHandler(int) Signals.cpp:0:0
 #2 0x00007f99fb600420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
 #3 0x00005600134444bf getDataDeps(llvm::MachineInstr const&, llvm::SmallVectorImpl<(anonymous namespace)::DataDep>&, llvm::MachineRegisterInfo const*) (.part.0) MachineTraceMetrics.cpp:0:0
 #4 0x0000560013446664 llvm::MachineTraceMetrics::Ensemble::computeInstrHeights(llvm::MachineBasicBlock const*) (/opt/compiler-explorer/clang-trunk/bin/llc+0x2639664)
 #5 0x0000560013449ccf llvm::MachineTraceMetrics::Ensemble::getTrace(llvm::MachineBasicBlock const*) (/opt/compiler-explorer/clang-trunk/bin/llc+0x263cccf)
 #6 0x0000560013351db6 (anonymous namespace)::MachineCombiner::combineInstructions(llvm::MachineBasicBlock*) MachineCombiner.cpp:0:0
 #7 0x00005600133532fb (anonymous namespace)::MachineCombiner::runOnMachineFunction(llvm::MachineFunction&) MachineCombiner.cpp:0:0
 #8 0x00005600133900c0 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0
 #9 0x0000560013876780 llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x2a69780)
#10 0x00005600138768f9 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x2a698f9)
#11 0x00005600138774e0 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x2a6a4e0)
#12 0x000056001180bfc3 compileModule(char**, llvm::LLVMContext&) llc.cpp:0:0
#13 0x000056001174489a main (/opt/compiler-explorer/clang-trunk/bin/llc+0x93789a)
#14 0x00007f99fb0ae083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#15 0x0000560011803f0e _start (/opt/compiler-explorer/clang-trunk/bin/llc+0x9f6f0e)
Compiler returned: 139
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0WF1v27gS_TX0C2GDoqivBz84cY0t0GCDZu--GhQ1ktlSpEBSrXN__QUlOZYc391tdxdok5jknDmcGZ4hzZ2TjQbYouQBJfsV7_3J2O2L1B50ZValqV63J-87h-IdogdED42pSqP8xtgG0cN_ET18yXj69KUonxDZI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