llvm / llvm-project

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

Crash compiling svdupq_n_f32 #109270

Open mplatings opened 1 day ago

mplatings commented 1 day ago

reduced.cpp:

__attribute__((__clang_arm_builtin_alias(__builtin_sve_svdupq_n_f32))) int
a(float, float, float, float);
float b, c;
int d = a(b, b, b, c);
$ clang -cc1 -triple aarch64-unknown-linux-gnu -emit-obj -target-feature -complxnum -target-feature -dotprod -target-feature -neon -target-feature -rdm -target-feature +sve2 reduced.cpp 
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: clang -cc1 -triple aarch64-unknown-linux-gnu -emit-obj -target-feature -complxnum -target-feature -dotprod -target-feature -neon -target-feature -rdm -target-feature +sve2 reduced.cpp
1.      <eof> parser at end of file
2.      Code generation
3.      Running pass 'Function Pass Manager' on module 'reduced.cpp'.
4.      Running pass 'AArch64 Instruction Selection' on function '@__cxx_global_var_init'
#0 0x000079d40725cefa llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/lib/llvm-20/bin/../lib/libLLVM.so.20.0+0xf8defa)
#1 0x000079d40725aa94 llvm::sys::RunSignalHandlers() (/usr/lib/llvm-20/bin/../lib/libLLVM.so.20.0+0xf8ba94)
#2 0x000079d40725d5ab (/usr/lib/llvm-20/bin/../lib/libLLVM.so.20.0+0xf8e5ab)
#3 0x000079d405d87990 (/lib/x86_64-linux-gnu/libc.so.6+0x42990)
#4 0x000079d4073bf69d llvm::MetadataTracking::track(void*, llvm::Metadata&, llvm::PointerUnion<llvm::MetadataAsValue*, llvm::Metadata*, llvm::DebugValueUser*>) (/usr/lib/llvm-20/bin/../lib/libLLVM.so.20.0+0x10f069d)
#5 0x000079d40928af66 (/usr/lib/llvm-20/bin/../lib/libLLVM.so.20.0+0x2fbbf66)
#6 0x00007fff8862ef88 
Segmentation fault (core dumped)
llvmbot commented 1 day ago

@llvm/issue-subscribers-backend-aarch64

Author: Michael Platings (mplatings)

`reduced.cpp`: ``` __attribute__((__clang_arm_builtin_alias(__builtin_sve_svdupq_n_f32))) int a(float, float, float, float); float b, c; int d = a(b, b, b, c); ``` ``` $ clang -cc1 -triple aarch64-unknown-linux-gnu -emit-obj -target-feature -complxnum -target-feature -dotprod -target-feature -neon -target-feature -rdm -target-feature +sve2 reduced.cpp 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: clang -cc1 -triple aarch64-unknown-linux-gnu -emit-obj -target-feature -complxnum -target-feature -dotprod -target-feature -neon -target-feature -rdm -target-feature +sve2 reduced.cpp 1. <eof> parser at end of file 2. Code generation 3. Running pass 'Function Pass Manager' on module 'reduced.cpp'. 4. Running pass 'AArch64 Instruction Selection' on function '@__cxx_global_var_init' #0 0x000079d40725cefa llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/lib/llvm-20/bin/../lib/libLLVM.so.20.0+0xf8defa) #1 0x000079d40725aa94 llvm::sys::RunSignalHandlers() (/usr/lib/llvm-20/bin/../lib/libLLVM.so.20.0+0xf8ba94) #2 0x000079d40725d5ab (/usr/lib/llvm-20/bin/../lib/libLLVM.so.20.0+0xf8e5ab) #3 0x000079d405d87990 (/lib/x86_64-linux-gnu/libc.so.6+0x42990) #4 0x000079d4073bf69d llvm::MetadataTracking::track(void*, llvm::Metadata&, llvm::PointerUnion<llvm::MetadataAsValue*, llvm::Metadata*, llvm::DebugValueUser*>) (/usr/lib/llvm-20/bin/../lib/libLLVM.so.20.0+0x10f069d) #5 0x000079d40928af66 (/usr/lib/llvm-20/bin/../lib/libLLVM.so.20.0+0x2fbbf66) #6 0x00007fff8862ef88 Segmentation fault (core dumped) ```
davemgreen commented 15 hours ago

Hi - Do you have a less reduced version of the original code, that still shows the same problem? I'm not sure it is valid to use __clang_arm_builtin_alias(__builtin_sve_svdupq_n_f32) outside of arm_sve.h, and in this case the return type of the "a" intrinsic would no match svdupq_n_f32.