llvm / llvm-project

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

clang: Assertion `Value != 0 && "Invalid CPUStr passed to CpuIs"' failed. #63568

Open wierton opened 1 year ago

wierton commented 1 year ago

The testcase (compiled with: clang small.c):

__attribute__((target_clones("arch=core-avx2", "arch=slm", "default")))
void foo(void) {}

Compiler Explorer: https://gcc.godbolt.org/z/xn6KrTcor

Compiler version:

clang version 17.0.0 (https://github.com/llvm/llvm-project.git 12e9c7aaa66b7624b5d7666ce2794d912bf9e4b7)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/compiler-explorer/clang-assertions-trunk/bin
Compiler returned: 0

Compiler's assertion message:

clang: /root/llvm-project/clang/lib/CodeGen/CGBuiltin.cpp:13186: llvm::Value* clang::CodeGen::CodeGenFunction::EmitX86CpuIs(llvm::StringRef): Assertion `Value != 0 && "Invalid CPUStr passed to CpuIs"' failed.

Compiler's backtrace:

clang: /root/llvm-project/clang/lib/CodeGen/CGBuiltin.cpp:13186: llvm::Value* clang::CodeGen::CodeGenFunction::EmitX86CpuIs(llvm::StringRef): Assertion `Value != 0 && "Invalid CPUStr passed to CpuIs"' failed.
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/compiler-explorer/clang-assertions-trunk/bin/clang -gdwarf-4 -g -o /app/output.s -S --gcc-toolchain=/opt/compiler-explorer/gcc-9.2.0 -fcolor-diagnostics -fno-crash-diagnostics <source>
1.  <eof> parser at end of file
2.  Per-file LLVM IR generation
 #0 0x00005611b5b24f2f llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3c52f2f)
 #1 0x00005611b5b22c9c llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3c50c9c)
 #2 0x00005611b5a6d398 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #3 0x00007f5f5bb25420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
 #4 0x00007f5f5b5f200b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
 #5 0x00007f5f5b5d1859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
 #6 0x00007f5f5b5d1729 (/lib/x86_64-linux-gnu/libc.so.6+0x22729)
 #7 0x00007f5f5b5e2fd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
 #8 0x00005611b6126096 clang::CodeGen::CodeGenFunction::EmitX86CpuIs(llvm::StringRef) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4254096)
 #9 0x00005611b5eb7ef0 clang::CodeGen::CodeGenFunction::EmitX86MultiVersionResolver(llvm::Function*, llvm::ArrayRef<clang::CodeGen::CodeGenFunction::MultiVersionResolverOption>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3fe5ef0)
#10 0x00005611b5f34277 clang::CodeGen::CodeGenModule::emitMultiVersionFunctions() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4062277)
#11 0x00005611b5f369a8 clang::CodeGen::CodeGenModule::Release() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x40649a8)
#12 0x00005611b6da12c2 (anonymous namespace)::CodeGeneratorImpl::HandleTranslationUnit(clang::ASTContext&) ModuleBuilder.cpp:0:0
#13 0x00005611b6d9fce5 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4ecdce5)
#14 0x00005611b829c059 clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x63ca059)
#15 0x00005611b6d9e9a8 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4ecc9a8)
#16 0x00005611b65e8b79 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4716b79)
#17 0x00005611b656e4c6 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x469c4c6)
#18 0x00005611b66cd2a6 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x47fb2a6)
#19 0x00005611b2fc70ed cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x10f50ed)
#20 0x00005611b2fc2dea ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#21 0x00005611b63cd23d void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const::'lambda'()>(long) Job.cpp:0:0
#22 0x00005611b5a6d8a0 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3b9b8a0)
#23 0x00005611b63cd85f clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (.part.0) Job.cpp:0:0
#24 0x00005611b63949ec clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x44c29ec)
#25 0x00005611b639547d clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x44c347d)
#26 0x00005611b639d55d clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x44cb55d)
#27 0x00005611b2fc534a clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x10f334a)
#28 0x00005611b2ecb5c5 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xff95c5)
#29 0x00007f5f5b5d3083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#30 0x00005611b2fbdbce _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x10ebbce)
clang: error: clang frontend command failed with exit code 134 (use -v to see invocation)
Compiler returned: 134
llvmbot commented 1 year ago

@llvm/issue-subscribers-clang-codegen