llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.82k stars 11.91k forks source link

Can't pass or return `half` or `fp128` on `arm64ec` #94434

Open beetrees opened 5 months ago

beetrees commented 5 months ago

Trying to compile the following IR for arm64ec-pc-windows-msvc (compiler explorer)

define half @half(half) {
    ret half %0
}

define fp128 @fp128(fp128) {
    ret fp128 %0
}

will fail with the following error:

LLVM ERROR: Only 32 and 64 bit floating points are supported for ARM64EC thunks
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 -mtriple=arm64ec-pc-windows-msvc <source>
1.  Running pass 'AArch64Arm64ECCallLowering' on module '<source>'.
 #0 0x00000000036ffd18 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-trunk/bin/llc+0x36ffd18)
 #1 0x00000000036fd68c SignalHandler(int) Signals.cpp:0:0
 #2 0x0000760bd1842520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #3 0x0000760bd18969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #4 0x0000760bd1842476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #5 0x0000760bd18287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #6 0x000000000072f886 llvm::UniqueStringSaver::save(llvm::StringRef) (.cold) StringSaver.cpp:0:0
 #7 0x000000000364f7d8 (/opt/compiler-explorer/clang-trunk/bin/llc+0x364f7d8)
 #8 0x0000000000a7732c (anonymous namespace)::AArch64Arm64ECCallLowering::canonicalizeThunkType(llvm::Type*, llvm::Align, bool, unsigned long, llvm::raw_ostream&, llvm::Type*&, llvm::Type*&) (.constprop.0) AArch64Arm64ECCallLowering.cpp:0:0
 #9 0x0000000000a7887f (anonymous namespace)::AArch64Arm64ECCallLowering::getThunkType(llvm::FunctionType*, llvm::AttributeList, llvm::COFF::Arm64ECThunkType, llvm::raw_ostream&, llvm::FunctionType*&, llvm::FunctionType*&) AArch64Arm64ECCallLowering.cpp:0:0
#10 0x0000000000a7fd73 (anonymous namespace)::AArch64Arm64ECCallLowering::buildEntryThunk(llvm::Function*) AArch64Arm64ECCallLowering.cpp:0:0
#11 0x0000000000a83dea (anonymous namespace)::AArch64Arm64ECCallLowering::runOnModule(llvm::Module&) (.part.0) AArch64Arm64ECCallLowering.cpp:0:0
#12 0x0000000002d44ac0 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x2d44ac0)
#13 0x00000000008483f4 compileModule(char**, llvm::LLVMContext&) llc.cpp:0:0
#14 0x0000000000741b86 main (/opt/compiler-explorer/clang-trunk/bin/llc+0x741b86)
#15 0x0000760bd1829d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#16 0x0000760bd1829e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#17 0x000000000084002e _start (/opt/compiler-explorer/clang-trunk/bin/llc+0x84002e)
Program terminated with signal: SIGSEGV
Compiler returned: 139
llvmbot commented 5 months ago

@llvm/issue-subscribers-backend-aarch64

Author: None (beetrees)

Trying to compile the following IR for `arm64ec-pc-windows-msvc` ([compiler explorer](https://godbolt.org/z/sqrn8Mnxo)) ```llvm define half @half(half) { ret half %0 } define fp128 @fp128(fp128) { ret fp128 %0 } ``` will fail with the following error: ``` LLVM ERROR: Only 32 and 64 bit floating points are supported for ARM64EC thunks 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 -mtriple=arm64ec-pc-windows-msvc <source> 1. Running pass 'AArch64Arm64ECCallLowering' on module '<source>'. #0 0x00000000036ffd18 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-trunk/bin/llc+0x36ffd18) #1 0x00000000036fd68c SignalHandler(int) Signals.cpp:0:0 #2 0x0000760bd1842520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520) #3 0x0000760bd18969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc) #4 0x0000760bd1842476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476) #5 0x0000760bd18287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3) #6 0x000000000072f886 llvm::UniqueStringSaver::save(llvm::StringRef) (.cold) StringSaver.cpp:0:0 #7 0x000000000364f7d8 (/opt/compiler-explorer/clang-trunk/bin/llc+0x364f7d8) #8 0x0000000000a7732c (anonymous namespace)::AArch64Arm64ECCallLowering::canonicalizeThunkType(llvm::Type*, llvm::Align, bool, unsigned long, llvm::raw_ostream&, llvm::Type*&, llvm::Type*&) (.constprop.0) AArch64Arm64ECCallLowering.cpp:0:0 #9 0x0000000000a7887f (anonymous namespace)::AArch64Arm64ECCallLowering::getThunkType(llvm::FunctionType*, llvm::AttributeList, llvm::COFF::Arm64ECThunkType, llvm::raw_ostream&, llvm::FunctionType*&, llvm::FunctionType*&) AArch64Arm64ECCallLowering.cpp:0:0 #10 0x0000000000a7fd73 (anonymous namespace)::AArch64Arm64ECCallLowering::buildEntryThunk(llvm::Function*) AArch64Arm64ECCallLowering.cpp:0:0 #11 0x0000000000a83dea (anonymous namespace)::AArch64Arm64ECCallLowering::runOnModule(llvm::Module&) (.part.0) AArch64Arm64ECCallLowering.cpp:0:0 #12 0x0000000002d44ac0 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x2d44ac0) #13 0x00000000008483f4 compileModule(char**, llvm::LLVMContext&) llc.cpp:0:0 #14 0x0000000000741b86 main (/opt/compiler-explorer/clang-trunk/bin/llc+0x741b86) #15 0x0000760bd1829d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90) #16 0x0000760bd1829e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40) #17 0x000000000084002e _start (/opt/compiler-explorer/clang-trunk/bin/llc+0x84002e) Program terminated with signal: SIGSEGV Compiler returned: 139 ```