Skip to content

[AArch64] -fp-armv8 crash using select with halfΒ #129394

Description

@tgross35

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

Activity

  1. changed the title [-]Crash related to `half` with `aarch64-unknown-none` and `-fp-armv8`[/-] [+][AArch64] `-fp-armv8` crash using `select` with `half` (regression)[/+] on Mar 1, 2025
  2. changed the title [-][AArch64] `-fp-armv8` crash using `select` with `half` (regression)[/-] [+][AArch64] `-fp-armv8` crash using `select` with `half`[/+] on Mar 1, 2025
  3. tgross35 commented on Mar 1, 2025

    @tgross35
    ContributorAuthor

    Actually this might not be a regression, testing locally with 19.1.7 (cd70802) still crashes if assertions are enabled. But without assertions it seems to produce correct assembly?

  4. llvmbot commented on Mar 1, 2025

    @llvmbot
    Member

    @llvm/issue-subscribers-backend-aarch64

    Author: Trevor Gross (tgross35)

    Details With LLVM20, the following hits an unreachable:
    target triple = "aarch64-unknown-linux-gnu"
    
    define half @<!-- -->problem(i16 %x, 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 &lt;source&gt;
    1.	Running pass 'Function Pass Manager' on module '&lt;source&gt;'.
    2.	Running pass 'AArch64 Instruction Selection' on function '@<!-- -->problem'
     #<!-- -->0 0x0000000003dea3d8 llvm::sys::PrintStackTrace(llvm::raw_ostream&amp;, 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&lt;llvm::SDValue&gt;&amp;, llvm::SelectionDAG&amp;) 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&amp;) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3b9c3b5)
    #<!-- -->14 0x0000000003b9d655 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&amp;) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3b9d655)
    #<!-- -->15 0x0000000003b8dacf llvm::SelectionDAGISelLegacy::runOnMachineFunction(llvm::MachineFunction&amp;) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3b8dacf)
    #<!-- -->16 0x0000000002d6e5da llvm::MachineFunctionPass::runOnFunction(llvm::Function&amp;) (.part.0) MachineFunctionPass.cpp:0:0
    #<!-- -->17 0x00000000033866ef llvm::FPPassManager::runOnFunction(llvm::Function&amp;) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x33866ef)
    #<!-- -->18 0x0000000003386aa1 llvm::FPPassManager::runOnModule(llvm::Module&amp;) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3386aa1)
    #<!-- -->19 0x0000000003387341 llvm::legacy::PassManagerImpl::run(llvm::Module&amp;) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3387341)
    #<!-- -->20 0x00000000008968d3 compileModule(char**, llvm::LLVMContext&amp;) 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

  5. added a commit that references this issue on Mar 2, 2025
  6. added a commit that references this issue on Mar 3, 2025
  7. added 2 commits that reference this issue on Mar 3, 2025
    6ddd019
    9128a5c
  8. 20 remaining items

  9. added a commit that references this issue on Apr 11, 2025
  10. added a commit that references this issue on Apr 12, 2025
  11. added a commit that references this issue on Apr 13, 2025
  12. added 2 commits that reference this issue on Apr 19, 2025
  13. added a commit that references this issue on Jul 1, 2025
  14. added a commit that references this issue on Jul 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions