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

    <tr>
        <th>Summary</th>
        <td>
            [ARM] crash lowering phi of frameaddress with v6 feature
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

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

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

<pre>
    ```llvm
target triple = "armv4t-unknown-linux"

define ptr @f(i1 %cond) "target-features"="+v6" {
0:
  br i1 undef, label %1, label %3

1:
  %2 = call ptr @llvm.frameaddress.p0(i32 0)
  br label %3

3:
  %4 = phi ptr [ null, %0 ], [ %2, %1 ]
  ret ptr %4
}

declare ptr @llvm.frameaddress.p0(i32)
```
```
$ clang --version
clang version 17.0.0 (https://github.com/llvm/llvm-project.git 242fe2d8d86e643e70443292751a08c456862198)
Target: x86_64-unknown-linux-gnu
Thread model: posix
$ clang -target armv4t-unknown-linux -mfloat-abi=soft repro.ll
clang-17: llvm/lib/CodeGen/PHIElimination.cpp:445: void (anonymous namespace)::PHIElimination::LowerPHINode(MachineBasicBlock &, MachineBasicBlock::iterator): Assertion `SrcReg.isVirtual() && "Machine PHI Operands must all be virtual registers!"' failed.
#10 0x00007f859b1716e2 (anonymous namespace)::PHIElimination::LowerPHINode(llvm::MachineBasicBlock&, llvm::MachineInstrBundleIterator<llvm::MachineInstr, false>) llvm/lib/CodeGen/PHIElimination.cpp:449:35
#11 0x00007f859b1702bb (anonymous namespace)::PHIElimination::EliminatePHINodes(llvm::MachineFunction&, llvm::MachineBasicBlock&) llvm/lib/CodeGen/PHIElimination.cpp:242:3
#12 0x00007f859b16f5dd (anonymous namespace)::PHIElimination::runOnMachineFunction(llvm::MachineFunction&) llvm/lib/CodeGen/PHIElimination.cpp:198:16
#13 0x00007f859aed717c llvm::MachineFunctionPass::runOnFunction(llvm::Function&) llvm/lib/CodeGen/MachineFunctionPass.cpp:91:8
$ llc -O0 repro.ll
llc: llvm/lib/CodeGen/PHIElimination.cpp:445: void (anonymous namespace)::PHIElimination::LowerPHINode(MachineBasicBlock &, MachineBasicBlock::iterator): Assertion `SrcReg.isVirtual() && "Machine PHI Operands must all be virtual registers!"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: llc -O0 repro.ll
1.      Running pass 'Function Pass Manager' on module 'repro.ll'.
2.      Running pass 'Eliminate PHI nodes for register allocation' on function '@f'
#10 0x00007feb561ef6e2 (anonymous namespace)::PHIElimination::LowerPHINode(llvm::MachineBasicBlock&, llvm::MachineInstrBundleIterator<llvm::MachineInstr, false>) llvm/lib/CodeGen/PHIElimination.cpp:449:35
#11 0x00007feb561ee2bb (anonymous namespace)::PHIElimination::EliminatePHINodes(llvm::MachineFunction&, llvm::MachineBasicBlock&) llvm/lib/CodeGen/PHIElimination.cpp:242:3
#12 0x00007feb561ed5dd (anonymous namespace)::PHIElimination::runOnMachineFunction(llvm::MachineFunction&) llvm/lib/CodeGen/PHIElimination.cpp:198:16
#13 0x00007feb55f5517c llvm::MachineFunctionPass::runOnFunction(llvm::Function&) llvm/lib/CodeGen/MachineFunctionPass.cpp:91:8
#14 0x00007feb5325d735 llvm::FPPassManager::runOnFunction(llvm::Function&) llvm/lib/IR/LegacyPassManager.cpp:1435:23
#15 0x00007feb53262c6f llvm::FPPassManager::runOnModule(llvm::Module&) llvm/lib/IR/LegacyPassManager.cpp:1481:16
#16 0x00007feb5325e0ab (anonymous namespace)::MPPassManager::runOnModule(llvm::Module&) llvm/lib/IR/LegacyPassManager.cpp:1550:23
#17 0x00007feb5325dbba llvm::legacy::PassManagerImpl::run(llvm::Module&) llvm/lib/IR/LegacyPassManager.cpp:535:16
#18 0x00007feb53262f71 llvm::legacy::PassManager::run(llvm::Module&) llvm/lib/IR/LegacyPassManager.cpp:1677:3
#19 0x000055d8751fcdaf compileModule(char**, llvm::LLVMContext&) llvm/tools/llc/llc.cpp:754:41
#20 0x000055d8751fb015 main llvm/tools/llc/llc.cpp:416:13
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsWFtv47oR_jX0C2GDF1GXBz_YcdwNkHSDbLGvBUVRMjcUKZBULv--oCQ7tuMim-0WaM85gKHEFPnNN98Mh2Ny71VjpFwCtgZsM-N92Fm3_MGFLfUrmpW2el2CFI0frZ9agDYArQJ3jQwwONVpCQHdQEAId-1TEua9eTT22cy1Mv0LIGRcMT4rWSsjYRccBAmqAckVhoAwYU0FSBFRRuh5LXnonfQRgG7ik6yfUkAIBNl6BEOATrAQlg4qDHtTyRqQK6h5KXUExiff6DEXfLQcEEYGNwTXek8vuruoHW8lryonvV90KDKmBCJAiiPTlw3QUwPJYKDbqRGfraHptY78AGEIArYZ_mfrgc00jofxCcTJMK4lLJkMZZtTeYXmTn7swIH-IbaXv5IECs1NA-fzJ-m8smZ8MQ5OQxBnC7RAEJB8F0Lno9tkC8i2UWHXlwthW0C2Q_KMf-adsz-kCItGBUgSUktS5VWeyjShMkNJQklBMoY5ykXC0jwluMgPlP8xJAigK_iSp_9Mk9OEmzemn-btnOQVbG0ldZzdWa9e3vk1ZfKl3IXzttaWhzkvFaAbb-sAneycXWh9JMMcZxF-758qAdle2Ur-TRpAtvdfbq61apXhQVmzEF0H6CpJWFzyZFUVVePGmtfW9h4a3krfcSGjt3QF6Op0_Th2a5-lu_9y83dbSUDyOy52ysg190qstRWPEJA05s-7F-NyFaTjwbrRBlx5L10EhyBF35x4kM1C-e_KhZ5rQPJxX6aApHF7Tpjw_ssN_NpJx03lYdv7AOPOKSV8GhdCJxvlg3QeEDxs3wzWXGlZLfYxoBhB9IIQQlmds6LEGU4l-Q2CDKEYXrxXYFTm3Ywb44Nb96bS8mYvD726PC0C1Fx7Ceh1FOdzkY9uUPamAT7TAJGy_BUN9gNy0sFfEmLbGzEs-TcynAn1Od9IQqJv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