llvm / llvm-project

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

segfault in clang-17 pass 'AArch64 Instruction Selection' while building google/highway on Mac OS X #97198

Open xavierlineX opened 4 months ago

xavierlineX commented 4 months ago

OS: Mac OS X 15.0 beta (24A5279h) Clang version: 17.0.6 Target: arm64-apple-darwin24.0.0 Thread model: posix

Project: github.com/google/highway (commit: 457c891775a7397bdb0376bb1031e6e027af1c48)

Backtrace:

PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.  Program arguments: /opt/port/libexec/llvm-17/bin/clang++ -DHWY_STATIC_DEFINE -DTOOLCHAIN_MISS_ASM_HWCAP_H -DTOOLCHAIN_MISS_SYS_AUXV_H -I/tmp/highway_macho/highway -O2 -g -DNDEBUG -std=c++17 -arch arm64 -isysroot /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.0.sdk -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -Wno-builtin-macro-redefined -D__DATE__=\"redacted\" -D__TIMESTAMP__=\"redacted\" -D__TIME__=\"redacted\" -fmerge-all-constants -Wall -Wextra -Wconversion -Wsign-conversion -Wvla -Wnon-virtual-dtor -Wcast-align -Wfloat-overflow-conversion -Wfloat-zero-conversion -Wfor-loop-analysis -Wgnu-redeclared-enum -Winfinite-recursion -Wself-assign -Wstring-conversion -Wtautological-overlap-compare -Wthread-safety-analysis -Wundefined-func-template -fno-cxx-exceptions -fno-slp-vectorize -fno-vectorize -fdiagnostics-show-option -fcolor-diagnostics -Wc++2a-extensions -fmath-errno -fno-exceptions -Wno-psabi -MD -MT CMakeFiles/hwy_contrib.dir/hwy/contrib/sort/vqsort_128a.cc.o -MF CMakeFiles/hwy_contrib.dir/hwy/contrib/sort/vqsort_128a.cc.o.d -o CMakeFiles/hwy_contrib.dir/hwy/contrib/sort/vqsort_128a.cc.o -c /tmp/highway_macho/highway/hwy/contrib/sort/vqsort_128a.cc
1.  <eof> parser at end of file
2.  Code generation
3.  Running pass 'Function Pass Manager' on module '/tmp/highway_macho/highway/hwy/contrib/sort/vqsort_128a.cc'.
4.  Running pass 'AArch64 Instruction Selection' on function '@_ZN3hwy5N_SVE6detail7RecurseILNS1_11RecurseModeE0ENS0_4SimdIyLm32ELi0EEENS1_12SharedTraitsINS1_9Traits128INS1_17OrderAscending128EEEEEyEEvT0_T1_PT2_mSE_Pymm'
 #0 0x000000010f8564dc llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/port/libexec/llvm-17/lib/libLLVM.dylib+0x1424dc)
 #1 0x000000010f854824 llvm::sys::RunSignalHandlers() (/opt/port/libexec/llvm-17/lib/libLLVM.dylib+0x140824)
 #2 0x000000010f855b84 llvm::sys::CleanupOnSignal(unsigned long) (/opt/port/libexec/llvm-17/lib/libLLVM.dylib+0x141b84)
 #3 0x000000010f7a6954 CrashRecoverySignalHandler(int) (/opt/port/libexec/llvm-17/lib/libLLVM.dylib+0x92954)
 #4 0x0000000182882184 (/usr/lib/system/libsystem_platform.dylib+0x180482184)
 #5 0x000000010fc60060 llvm::MachineInstr::addOperand(llvm::MachineFunction&, llvm::MachineOperand const&) (/opt/port/libexec/llvm-17/lib/libLLVM.dylib+0x54c060)
 #6 0x000000010fad67b0 llvm::BuildMI(llvm::MachineBasicBlock&, llvm::MachineInstrBundleIterator<llvm::MachineInstr, false>, llvm::MIMetadata const&, llvm::MCInstrDesc const&, llvm::Register) (/opt/port/libexec/llvm-17/lib/libLLVM.dylib+0x3c27b0)
 #7 0x000000010ffb3570 llvm::InstrEmitter::EmitSpecialNode(llvm::SDNode*, bool, bool, llvm::DenseMap<llvm::SDValue, llvm::Register, llvm::DenseMapInfo<llvm::SDValue, void>, llvm::detail::DenseMapPair<llvm::SDValue, llvm::Register>>&) (/opt/port/libexec/llvm-17/lib/libLLVM.dylib+0x89f570)
 #8 0x0000000110042854 llvm::ScheduleDAGSDNodes::EmitSchedule(llvm::MachineInstrBundleIterator<llvm::MachineInstr, false>&)::$_1::operator()(llvm::SDNode*, bool, bool, llvm::DenseMap<llvm::SDValue, llvm::Register, llvm::DenseMapInfo<llvm::SDValue, void>, llvm::detail::DenseMapPair<llvm::SDValue, llvm::Register>>&) const (/opt/port/libexec/llvm-17/lib/libLLVM.dylib+0x92e854)
 #9 0x0000000110041e00 llvm::ScheduleDAGSDNodes::EmitSchedule(llvm::MachineInstrBundleIterator<llvm::MachineInstr, false>&) (/opt/port/libexec/llvm-17/lib/libLLVM.dylib+0x92de00)
#10 0x00000001100d6a50 llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/opt/port/libexec/llvm-17/lib/libLLVM.dylib+0x9c2a50)
#11 0x00000001100d5fb8 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/opt/port/libexec/llvm-17/lib/libLLVM.dylib+0x9c1fb8)
#12 0x00000001100d4008 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (/opt/port/libexec/llvm-17/lib/libLLVM.dylib+0x9c0008)
#13 0x000000010fc59d9c llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (/opt/port/libexec/llvm-17/lib/libLLVM.dylib+0x545d9c)
#14 0x000000010f9c20e4 llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/port/libexec/llvm-17/lib/libLLVM.dylib+0x2ae0e4)
#15 0x000000010f9c8d9c llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/port/libexec/llvm-17/lib/libLLVM.dylib+0x2b4d9c)
#16 0x000000010f9c2ac0 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/port/libexec/llvm-17/lib/libLLVM.dylib+0x2aeac0)
#17 0x0000000105469394 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, std::__1::unique_ptr<llvm::raw_pwrite_stream, std::__1::default_delete<llvm::raw_pwrite_stream>>) (/opt/port/libexec/llvm-17/lib/libclang-cpp.dylib+0x1145394)
#18 0x000000010577fa7c clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/opt/port/libexec/llvm-17/lib/libclang-cpp.dylib+0x145ba7c)
#19 0x0000000104490dc0 clang::ParseAST(clang::Sema&, bool, bool) (/opt/port/libexec/llvm-17/lib/libclang-cpp.dylib+0x16cdc0)
#20 0x000000010615be70 clang::FrontendAction::Execute() (/opt/port/libexec/llvm-17/lib/libclang-cpp.dylib+0x1e37e70)
#21 0x00000001060ea3f4 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/port/libexec/llvm-17/lib/libclang-cpp.dylib+0x1dc63f4)
#22 0x00000001061d1fac clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/port/libexec/llvm-17/lib/libclang-cpp.dylib+0x1eadfac)
#23 0x00000001003f9e40 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/port/libexec/llvm-17/bin/clang+0x100009e40)
#24 0x00000001003f80f0 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) (/opt/port/libexec/llvm-17/bin/clang+0x1000080f0)
#25 0x0000000105dbbdc0 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<std::__1::optional<llvm::StringRef>>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>*, bool*) const::$_1>(long) (/opt/port/libexec/llvm-17/lib/libclang-cpp.dylib+0x1a97dc0)
#26 0x000000010f7a66b0 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/port/libexec/llvm-17/lib/libLLVM.dylib+0x926b0)
#27 0x0000000105dbb63c clang::driver::CC1Command::Execute(llvm::ArrayRef<std::__1::optional<llvm::StringRef>>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>*, bool*) const (/opt/port/libexec/llvm-17/lib/libclang-cpp.dylib+0x1a9763c)
#28 0x0000000105d89928 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/port/libexec/llvm-17/lib/libclang-cpp.dylib+0x1a65928)
#29 0x0000000105d89c64 clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::__1::pair<int, clang::driver::Command const*>>&, bool) const (/opt/port/libexec/llvm-17/lib/libclang-cpp.dylib+0x1a65c64)
#30 0x0000000105da2058 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::__1::pair<int, clang::driver::Command const*>>&) (/opt/port/libexec/llvm-17/lib/libclang-cpp.dylib+0x1a7e058)
#31 0x00000001003f7310 clang_main(int, char**, llvm::ToolContext const&) (/opt/port/libexec/llvm-17/bin/clang+0x100007310)
#32 0x00000001004022d0 main (/opt/port/libexec/llvm-17/bin/clang+0x1000122d0)
#33 0x00000001824cb274
clang++: error: clang frontend command failed with exit code 139 (use -v to see invocation)
clang version 17.0.6
Target: arm64-apple-darwin24.0.0
Thread model: posix
InstalledDir: /opt/port/libexec/llvm-17/bin

bugreport.tar.gz

llvmbot commented 4 months ago

@llvm/issue-subscribers-backend-aarch64

Author: None (xavierlineX)

OS: Mac OS X 15.0 beta (24A5279h) Clang version: 17.0.6 Target: arm64-apple-darwin24.0.0 Thread model: posix Project: github.com/google/highway (commit: `457c891775a7397bdb0376bb1031e6e027af1c48`) Backtrace: ``` PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script. Stack dump: 0. Program arguments: /opt/port/libexec/llvm-17/bin/clang++ -DHWY_STATIC_DEFINE -DTOOLCHAIN_MISS_ASM_HWCAP_H -DTOOLCHAIN_MISS_SYS_AUXV_H -I/tmp/highway_macho/highway -O2 -g -DNDEBUG -std=c++17 -arch arm64 -isysroot /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.0.sdk -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -Wno-builtin-macro-redefined -D__DATE__=\"redacted\" -D__TIMESTAMP__=\"redacted\" -D__TIME__=\"redacted\" -fmerge-all-constants -Wall -Wextra -Wconversion -Wsign-conversion -Wvla -Wnon-virtual-dtor -Wcast-align -Wfloat-overflow-conversion -Wfloat-zero-conversion -Wfor-loop-analysis -Wgnu-redeclared-enum -Winfinite-recursion -Wself-assign -Wstring-conversion -Wtautological-overlap-compare -Wthread-safety-analysis -Wundefined-func-template -fno-cxx-exceptions -fno-slp-vectorize -fno-vectorize -fdiagnostics-show-option -fcolor-diagnostics -Wc++2a-extensions -fmath-errno -fno-exceptions -Wno-psabi -MD -MT CMakeFiles/hwy_contrib.dir/hwy/contrib/sort/vqsort_128a.cc.o -MF CMakeFiles/hwy_contrib.dir/hwy/contrib/sort/vqsort_128a.cc.o.d -o CMakeFiles/hwy_contrib.dir/hwy/contrib/sort/vqsort_128a.cc.o -c /tmp/highway_macho/highway/hwy/contrib/sort/vqsort_128a.cc 1. <eof> parser at end of file 2. Code generation 3. Running pass 'Function Pass Manager' on module '/tmp/highway_macho/highway/hwy/contrib/sort/vqsort_128a.cc'. 4. Running pass 'AArch64 Instruction Selection' on function '@_ZN3hwy5N_SVE6detail7RecurseILNS1_11RecurseModeE0ENS0_4SimdIyLm32ELi0EEENS1_12SharedTraitsINS1_9Traits128INS1_17OrderAscending128EEEEEyEEvT0_T1_PT2_mSE_Pymm' #0 0x000000010f8564dc llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/port/libexec/llvm-17/lib/libLLVM.dylib+0x1424dc) #1 0x000000010f854824 llvm::sys::RunSignalHandlers() (/opt/port/libexec/llvm-17/lib/libLLVM.dylib+0x140824) #2 0x000000010f855b84 llvm::sys::CleanupOnSignal(unsigned long) (/opt/port/libexec/llvm-17/lib/libLLVM.dylib+0x141b84) #3 0x000000010f7a6954 CrashRecoverySignalHandler(int) (/opt/port/libexec/llvm-17/lib/libLLVM.dylib+0x92954) #4 0x0000000182882184 (/usr/lib/system/libsystem_platform.dylib+0x180482184) #5 0x000000010fc60060 llvm::MachineInstr::addOperand(llvm::MachineFunction&, llvm::MachineOperand const&) (/opt/port/libexec/llvm-17/lib/libLLVM.dylib+0x54c060) #6 0x000000010fad67b0 llvm::BuildMI(llvm::MachineBasicBlock&, llvm::MachineInstrBundleIterator<llvm::MachineInstr, false>, llvm::MIMetadata const&, llvm::MCInstrDesc const&, llvm::Register) (/opt/port/libexec/llvm-17/lib/libLLVM.dylib+0x3c27b0) #7 0x000000010ffb3570 llvm::InstrEmitter::EmitSpecialNode(llvm::SDNode*, bool, bool, llvm::DenseMap<llvm::SDValue, llvm::Register, llvm::DenseMapInfo<llvm::SDValue, void>, llvm::detail::DenseMapPair<llvm::SDValue, llvm::Register>>&) (/opt/port/libexec/llvm-17/lib/libLLVM.dylib+0x89f570) #8 0x0000000110042854 llvm::ScheduleDAGSDNodes::EmitSchedule(llvm::MachineInstrBundleIterator<llvm::MachineInstr, false>&)::$_1::operator()(llvm::SDNode*, bool, bool, llvm::DenseMap<llvm::SDValue, llvm::Register, llvm::DenseMapInfo<llvm::SDValue, void>, llvm::detail::DenseMapPair<llvm::SDValue, llvm::Register>>&) const (/opt/port/libexec/llvm-17/lib/libLLVM.dylib+0x92e854) #9 0x0000000110041e00 llvm::ScheduleDAGSDNodes::EmitSchedule(llvm::MachineInstrBundleIterator<llvm::MachineInstr, false>&) (/opt/port/libexec/llvm-17/lib/libLLVM.dylib+0x92de00) #10 0x00000001100d6a50 llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/opt/port/libexec/llvm-17/lib/libLLVM.dylib+0x9c2a50) #11 0x00000001100d5fb8 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/opt/port/libexec/llvm-17/lib/libLLVM.dylib+0x9c1fb8) #12 0x00000001100d4008 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (/opt/port/libexec/llvm-17/lib/libLLVM.dylib+0x9c0008) #13 0x000000010fc59d9c llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (/opt/port/libexec/llvm-17/lib/libLLVM.dylib+0x545d9c) #14 0x000000010f9c20e4 llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/port/libexec/llvm-17/lib/libLLVM.dylib+0x2ae0e4) #15 0x000000010f9c8d9c llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/port/libexec/llvm-17/lib/libLLVM.dylib+0x2b4d9c) #16 0x000000010f9c2ac0 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/port/libexec/llvm-17/lib/libLLVM.dylib+0x2aeac0) #17 0x0000000105469394 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, std::__1::unique_ptr<llvm::raw_pwrite_stream, std::__1::default_delete<llvm::raw_pwrite_stream>>) (/opt/port/libexec/llvm-17/lib/libclang-cpp.dylib+0x1145394) #18 0x000000010577fa7c clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/opt/port/libexec/llvm-17/lib/libclang-cpp.dylib+0x145ba7c) #19 0x0000000104490dc0 clang::ParseAST(clang::Sema&, bool, bool) (/opt/port/libexec/llvm-17/lib/libclang-cpp.dylib+0x16cdc0) #20 0x000000010615be70 clang::FrontendAction::Execute() (/opt/port/libexec/llvm-17/lib/libclang-cpp.dylib+0x1e37e70) #21 0x00000001060ea3f4 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/port/libexec/llvm-17/lib/libclang-cpp.dylib+0x1dc63f4) #22 0x00000001061d1fac clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/port/libexec/llvm-17/lib/libclang-cpp.dylib+0x1eadfac) #23 0x00000001003f9e40 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/port/libexec/llvm-17/bin/clang+0x100009e40) #24 0x00000001003f80f0 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) (/opt/port/libexec/llvm-17/bin/clang+0x1000080f0) #25 0x0000000105dbbdc0 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<std::__1::optional<llvm::StringRef>>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>*, bool*) const::$_1>(long) (/opt/port/libexec/llvm-17/lib/libclang-cpp.dylib+0x1a97dc0) #26 0x000000010f7a66b0 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/port/libexec/llvm-17/lib/libLLVM.dylib+0x926b0) #27 0x0000000105dbb63c clang::driver::CC1Command::Execute(llvm::ArrayRef<std::__1::optional<llvm::StringRef>>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>*, bool*) const (/opt/port/libexec/llvm-17/lib/libclang-cpp.dylib+0x1a9763c) #28 0x0000000105d89928 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/port/libexec/llvm-17/lib/libclang-cpp.dylib+0x1a65928) #29 0x0000000105d89c64 clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::__1::pair<int, clang::driver::Command const*>>&, bool) const (/opt/port/libexec/llvm-17/lib/libclang-cpp.dylib+0x1a65c64) #30 0x0000000105da2058 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::__1::pair<int, clang::driver::Command const*>>&) (/opt/port/libexec/llvm-17/lib/libclang-cpp.dylib+0x1a7e058) #31 0x00000001003f7310 clang_main(int, char**, llvm::ToolContext const&) (/opt/port/libexec/llvm-17/bin/clang+0x100007310) #32 0x00000001004022d0 main (/opt/port/libexec/llvm-17/bin/clang+0x1000122d0) #33 0x00000001824cb274 clang++: error: clang frontend command failed with exit code 139 (use -v to see invocation) clang version 17.0.6 Target: arm64-apple-darwin24.0.0 Thread model: posix InstalledDir: /opt/port/libexec/llvm-17/bin ``` [bugreport.tar.gz](https://github.com/user-attachments/files/16043838/bugreport.tar.gz)
EugeneZelenko commented 4 months ago

Could you please try 18 or main branch? https://godbolt.org should be helpful.

DimitryAndric commented 4 months ago

The assertion is:

Assertion failed: (!Res && "Call operand has unhandled type"), function analyzeCallOperands, file /home/dim/src/llvm/llvm-project/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp, line 6892.
...
1.      <eof> parser at end of file
2.      Code generation
3.      Running pass 'Function Pass Manager' on module 'vqsort_128a-65897c.cpp'.
4.      Running pass 'AArch64 Instruction Selection' on function '@_ZN3hwy5N_SVE6detail7RecurseILNS1_11RecurseModeE0ENS0_4SimdIyLm32ELi0EEENS1_12SharedTraitsINS1_9Traits128INS1_17OrderAscending128EEEEEyEEvT0_T1_PT2_mSE_Pymm'
 #0 0x00000000043ce487 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/dim/ins/llvmorg-18-init-00000-g4706251a318/bin/clang+0x43ce487)
 #1 0x00000000043cc268 llvm::sys::RunSignalHandlers() (/home/dim/ins/llvmorg-18-init-00000-g4706251a318/bin/clang+0x43cc268)
 #2 0x00000000043cec60 SignalHandler(int) Signals.cpp:0:0
 #3 0x000000082947c4af handle_signal /usr/src/lib/libthr/thread/thr_sig.c:0:3
 #4 0x000000082947ba6b thr_sighandler /usr/src/lib/libthr/thread/thr_sig.c:245:1
 #5 0x00000008285382d3 ([vdso]+0x2d3)
 #6 0x000000082eaf2a0a __sys_thr_kill /usr/obj/usr/src/lib/libc/thr_kill.S:4:0
 #7 0x000000082ea6c1e4 _raise /usr/src/lib/libc/gen/raise.c:0:10
 #8 0x000000082eb1cbc9 abort /usr/src/lib/libc/stdlib/abort.c:71:17
 #9 0x000000082ea4f551 (/lib/libc.so.7+0x93551)
#10 0x00000000029abbd1 (/home/dim/ins/llvmorg-18-init-00000-g4706251a318/bin/clang+0x29abbd1)
#11 0x00000000029ac489 llvm::AArch64TargetLowering::LowerCall(llvm::TargetLowering::CallLoweringInfo&, llvm::SmallVectorImpl<llvm::SDValue>&) const AArch64ISelLowering.cpp:0:0
#12 0x00000000053c4816 llvm::TargetLowering::LowerCallTo(llvm::TargetLowering::CallLoweringInfo&) const (/home/dim/ins/llvmorg-18-init-00000-g4706251a318/bin/clang+0x53c4816)
...

so this is likely a duplicate of either #69147 or #69694. The former was fixed with #70034, the latter with #70847.

xavierlineX commented 4 months ago

Could you please try 18 or main branch?

Tested on clang version 18.1.8, got another error (fatal error: error in backend: Invalid size request on a scalable vector.).

0.  Program arguments: /opt/port/libexec/llvm-18/bin/clang++ -DHWY_STATIC_DEFINE -DTOOLCHAIN_MISS_ASM_HWCAP_H -DTOOLCHAIN_MISS_SYS_AUXV_H -I/tmp/highway_macho/highway -O2 -g -DNDEBUG -std=c++17 -arch arm64 -isysroot /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.0.sdk -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -Wno-builtin-macro-redefined -D__DATE__=\"redacted\" -D__TIMESTAMP__=\"redacted\" -D__TIME__=\"redacted\" -fmerge-all-constants -Wall -Wextra -Wconversion -Wsign-conversion -Wvla -Wnon-virtual-dtor -Wcast-align -Wfloat-overflow-conversion -Wfloat-zero-conversion -Wfor-loop-analysis -Wgnu-redeclared-enum -Winfinite-recursion -Wself-assign -Wstring-conversion -Wtautological-overlap-compare -Wthread-safety-analysis -Wundefined-func-template -fno-cxx-exceptions -fno-slp-vectorize -fno-vectorize -fdiagnostics-show-option -fcolor-diagnostics -Wc++2a-extensions -fmath-errno -fno-exceptions -Wno-psabi -MD -MT CMakeFiles/hwy_contrib.dir/hwy/contrib/sort/vqsort_128a.cc.o -MF CMakeFiles/hwy_contrib.dir/hwy/contrib/sort/vqsort_128a.cc.o.d -o CMakeFiles/hwy_contrib.dir/hwy/contrib/sort/vqsort_128a.cc.o -c /tmp/highway_macho/highway/hwy/contrib/sort/vqsort_128a.cc
1.  <eof> parser at end of file
2.  Code generation
3.  Running pass 'Function Pass Manager' on module '/tmp/highway_macho/highway/hwy/contrib/sort/vqsort_128a.cc'.
4.  Running pass 'AArch64 Instruction Selection' on function '@_ZN3hwy5N_SVE6detail7RecurseILNS1_11RecurseModeE0ENS0_4SimdIyLm32ELi0EEENS1_12SharedTraitsINS1_9Traits128INS1_17OrderAscending128EEEEEyEEvT0_T1_PT2_mSE_Pymm'
 #0 0x0000000112ff3e6c llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/port/libexec/llvm-18/lib/libLLVM.dylib+0x147e6c)
 #1 0x0000000112ff20bc llvm::sys::RunSignalHandlers() (/opt/port/libexec/llvm-18/lib/libLLVM.dylib+0x1460bc)
 #2 0x0000000112ff3520 llvm::sys::CleanupOnSignal(unsigned long) (/opt/port/libexec/llvm-18/lib/libLLVM.dylib+0x147520)
 #3 0x0000000112f3fa10 (anonymous namespace)::CrashRecoveryContextImpl::HandleCrash(int, unsigned long) (/opt/port/libexec/llvm-18/lib/libLLVM.dylib+0x93a10)
 #4 0x0000000112f3f9c0 llvm::CrashRecoveryContext::HandleExit(int) (/opt/port/libexec/llvm-18/lib/libLLVM.dylib+0x939c0)
 #5 0x0000000112fef0a0 llvm::sys::Process::Exit(int, bool) (/opt/port/libexec/llvm-18/lib/libLLVM.dylib+0x1430a0)
 #6 0x00000001047de004 llvm::AliasSetTracker::~AliasSetTracker() (/opt/port/libexec/llvm-18/bin/clang+0x10000a004)
 #7 0x0000000112f4d624 llvm::report_fatal_error(llvm::Twine const&, bool) (/opt/port/libexec/llvm-18/lib/libLLVM.dylib+0xa1624)
 #8 0x0000000112f4d4fc llvm::report_fatal_error(llvm::Twine const&, bool) (/opt/port/libexec/llvm-18/lib/libLLVM.dylib+0xa14fc)
 #9 0x0000000112fac0dc llvm::TypeSize::operator unsigned long long() const (/opt/port/libexec/llvm-18/lib/libLLVM.dylib+0x1000dc)
#10 0x0000000112fac100 llvm::TypeSize::operator unsigned long long() const (/opt/port/libexec/llvm-18/lib/libLLVM.dylib+0x100100)
#11 0x0000000114c45754 llvm::AArch64TargetLowering::LowerCall(llvm::TargetLowering::CallLoweringInfo&, llvm::SmallVectorImpl<llvm::SDValue>&) const (/opt/port/libexec/llvm-18/lib/libLLVM.dylib+0x1d99754)
#12 0x0000000113784c3c llvm::TargetLowering::LowerCallTo(llvm::TargetLowering::CallLoweringInfo&) const (/opt/port/libexec/llvm-18/lib/libLLVM.dylib+0x8d8c3c)
#13 0x000000011379b120 llvm::SelectionDAGBuilder::lowerInvokable(llvm::TargetLowering::CallLoweringInfo&, llvm::BasicBlock const*) (/opt/port/libexec/llvm-18/lib/libLLVM.dylib+0x8ef120)
#14 0x000000011378af00 llvm::SelectionDAGBuilder::LowerCallTo(llvm::CallBase const&, llvm::SDValue, bool, bool, llvm::BasicBlock const*) (/opt/port/libexec/llvm-18/lib/libLLVM.dylib+0x8def00)
#15 0x0000000113779c58 llvm::SelectionDAGBuilder::visitCall(llvm::CallInst const&) (/opt/port/libexec/llvm-18/lib/libLLVM.dylib+0x8cdc58)
#16 0x000000011376e2e0 llvm::SelectionDAGBuilder::visit(llvm::Instruction const&) (/opt/port/libexec/llvm-18/lib/libLLVM.dylib+0x8c22e0)
#17 0x00000001137f8430 llvm::SelectionDAGISel::SelectBasicBlock(llvm::ilist_iterator_w_bits<llvm::ilist_detail::node_options<llvm::Instruction, false, false, void, true>, false, true>, llvm::ilist_iterator_w_bits<llvm::ilist_detail::node_options<llvm::Instruction, false, false, void, true>, false, true>, bool&) (/opt/port/libexec/llvm-18/lib/libLLVM.dylib+0x94c430)
#18 0x00000001137f7c14 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/opt/port/libexec/llvm-18/lib/libLLVM.dylib+0x94bc14)
#19 0x00000001137f594c llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (/opt/port/libexec/llvm-18/lib/libLLVM.dylib+0x94994c)
#20 0x000000011339f96c llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (/opt/port/libexec/llvm-18/lib/libLLVM.dylib+0x4f396c)
#21 0x0000000113142b64 llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/port/libexec/llvm-18/lib/libLLVM.dylib+0x296b64)
#22 0x0000000113149a48 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/port/libexec/llvm-18/lib/libLLVM.dylib+0x29da48)
#23 0x000000011314357c llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/port/libexec/llvm-18/lib/libLLVM.dylib+0x29757c)
#24 0x000000010927f610 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, std::__1::unique_ptr<llvm::raw_pwrite_stream, std::__1::default_delete<llvm::raw_pwrite_stream>>, clang::BackendConsumer*) (/opt/port/libexec/llvm-18/lib/libclang-cpp.dylib+0xfef610)
#25 0x0000000109572268 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/opt/port/libexec/llvm-18/lib/libclang-cpp.dylib+0x12e2268)
#26 0x0000000108448370 clang::ParseAST(clang::Sema&, bool, bool) (/opt/port/libexec/llvm-18/lib/libclang-cpp.dylib+0x1b8370)
#27 0x0000000109d0a6c0 clang::FrontendAction::Execute() (/opt/port/libexec/llvm-18/lib/libclang-cpp.dylib+0x1a7a6c0)
#28 0x0000000109ca0624 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/port/libexec/llvm-18/lib/libclang-cpp.dylib+0x1a10624)
#29 0x0000000109d72fa0 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/port/libexec/llvm-18/lib/libclang-cpp.dylib+0x1ae2fa0)
#30 0x00000001047dd97c cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/port/libexec/llvm-18/bin/clang+0x10000997c)
#31 0x00000001047db68c ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) (/opt/port/libexec/llvm-18/bin/clang+0x10000768c)
#32 0x00000001099b06b0 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<std::__1::optional<llvm::StringRef>>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>*, bool*) const::$_0>(long) (/opt/port/libexec/llvm-18/lib/libclang-cpp.dylib+0x17206b0)
#33 0x0000000112f3f998 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/port/libexec/llvm-18/lib/libLLVM.dylib+0x93998)
#34 0x00000001099b005c clang::driver::CC1Command::Execute(llvm::ArrayRef<std::__1::optional<llvm::StringRef>>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>*, bool*) const (/opt/port/libexec/llvm-18/lib/libclang-cpp.dylib+0x172005c)
#35 0x000000010997f25c clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/port/libexec/llvm-18/lib/libclang-cpp.dylib+0x16ef25c)
#36 0x000000010997f46c clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::__1::pair<int, clang::driver::Command const*>>&, bool) const (/opt/port/libexec/llvm-18/lib/libclang-cpp.dylib+0x16ef46c)
#37 0x0000000109997884 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::__1::pair<int, clang::driver::Command const*>>&) (/opt/port/libexec/llvm-18/lib/libclang-cpp.dylib+0x1707884)
#38 0x00000001047da8d4 clang_main(int, char**, llvm::ToolContext const&) (/opt/port/libexec/llvm-18/bin/clang+0x1000068d4)
#39 0x00000001047e630c main (/opt/port/libexec/llvm-18/bin/clang+0x10001230c)
#40 0x00000001824cb274

Preprocessed source and associated run script: bugreport-18_1_8.tar.gz

Seems like a duplicate of #96156.

tgymnich commented 4 months ago

Which CPU are you targeting?

Assertion failed: (!Res && "Call operand has unhandled type"), function analyzeCallOperands, file /home/dim/src/llvm/llvm-project/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp, line 6892.

Seems to fail because ArgVT is nxv8f16 and I don't recall M1 supporting SVE.

jan-wassenberg commented 1 month ago

For context, Highway uses pragma target to enable various targets, including SVE. We, and the users, do not know whether SVE is going to be supported at compile time; dynamic dispatch decides that.