[AArch64] -fp-armv8 crash using select with half · Issue #129394 · llvm/llvm-project (original) (raw)

With LLVM20, the following hits an unreachable:

target triple = "aarch64-unknown-linux-gnu"

define half @problem(i1 %sel) #1 { %x1 = select i1 %sel, half 0xH0000, half 0xH0001 ret half %x1 }

attributes #1 = { "target-features" = "-fp-armv8" }

Don't know how to custom expand this
UNREACHABLE executed at /root/llvm-project/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp:27434!
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-assertions-trunk/bin/llc -o /app/output.s -x86-asm-syntax=intel -O0 <source>
1.	Running pass 'Function Pass Manager' on module '<source>'.
2.	Running pass 'AArch64 Instruction Selection' on function '@problem'
 #0 0x0000000003dea3d8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3dea3d8)
 #1 0x0000000003de7d94 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
 #2 0x00007f2088c42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #3 0x00007f2088c969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #4 0x00007f2088c42476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #5 0x00007f2088c287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #6 0x0000000003d3d47a (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3d3d47a)
 #7 0x0000000000d18395 llvm::AArch64TargetLowering::ReplaceNodeResults(llvm::SDNode*, llvm::SmallVectorImpl<llvm::SDValue>&, llvm::SelectionDAG&) const (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0xd18395)
 #8 0x0000000003c2ed76 llvm::DAGTypeLegalizer::CustomLowerNode(llvm::SDNode*, llvm::EVT, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3c2ed76)
 #9 0x0000000003cac753 llvm::DAGTypeLegalizer::SoftPromoteHalfResult(llvm::SDNode*, unsigned int) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3cac753)
#10 0x0000000003c2f44b llvm::DAGTypeLegalizer::run() (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3c2f44b)
#11 0x0000000003c30699 llvm::SelectionDAG::LegalizeTypes() (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3c30699)
#12 0x0000000003b9873b llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3b9873b)
#13 0x0000000003b9c3b5 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3b9c3b5)
#14 0x0000000003b9d655 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3b9d655)
#15 0x0000000003b8dacf llvm::SelectionDAGISelLegacy::runOnMachineFunction(llvm::MachineFunction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3b8dacf)
#16 0x0000000002d6e5da llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0
#17 0x00000000033866ef llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x33866ef)
#18 0x0000000003386aa1 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3386aa1)
#19 0x0000000003387341 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3387341)
#20 0x00000000008968d3 compileModule(char**, llvm::LLVMContext&) llc.cpp:0:0
#21 0x0000000000784dee main (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x784dee)
#22 0x00007f2088c29d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#23 0x00007f2088c29e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#24 0x000000000088d0b5 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x88d0b5)
Program terminated with signal: SIGSEGV
Compiler returned: 139

This worked correctly in LLVM19

https://llvm.godbolt.org/z/Ge8ozGxYG