-
Notifications
You must be signed in to change notification settings - Fork 10.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LLVM 18 regression: -Os causes Cannot select: t98: v8f16,ch = X86ISD::VBROADCAST_LOAD #91005
Labels
Milestone
Comments
andrewrk
added
bug
Indicates an unexpected problem or unintended behavior
backend:X86
regression
platform:macos
labels
May 3, 2024
cc @llvm/issue-subscribers-backend-x86 |
@llvm/issue-subscribers-bug Author: Andrew Kelley (andrewrk)
version: 18.1.5
target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-macosx11.7.1-unknown"
%"compiler_rt.mulc3.Complex(f16)" = type { half, half }
; Function Attrs: minsize
define void @<!-- -->__mulhc3(ptr sret(%"compiler_rt.mulc3.Complex(f16)") %0, half %1, half %2, half %3, half %4) #<!-- -->0 {
%6 = call half @<!-- -->llvm.fabs.f16(half %1)
%7 = bitcast half %6 to i16
%8 = icmp eq i16 %7, 31744
%9 = call half @<!-- -->llvm.fabs.f16(half %2)
%10 = bitcast half %9 to i16
%11 = icmp eq i16 %10, 31744
%12 = select i1 %8, i1 true, i1 %11
br i1 %12, label %13, label %common.ret
common.ret: ; preds = %13, %5
ret void
13: ; preds = %5
%.1 = select i1 %11, half 0xH3C00, half 0xH0000
%14 = fmul half %.1, %2
%. = select i1 %8, half 0xH3C00, half 0xH0000
%15 = fmul half %., %1
%16 = fsub half %15, %14
store half %16, ptr %0, align 2
br label %common.ret
}
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare half @<!-- -->llvm.fabs.f16(half) #<!-- -->1
; uselistorder directives
uselistorder ptr @<!-- -->llvm.fabs.f16, { 1, 0 }
attributes #<!-- -->0 = { minsize "target-cpu"="ivybridge" }
attributes #<!-- -->1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } [nix-shell:~/src/zig/build-llvm18-release]$ ~/local/llvm18-assert/bin/clang -c reduced.ll -target x86_64-unknown-macosx11.7.1-unknown -Os
fatal error: error in backend: Cannot select: t98: v8f16,ch = X86ISD::VBROADCAST_LOAD<(load (s16) from constant-pool)> t0, t106
t106: i64 = X86ISD::WrapperRIP TargetConstantPool:i64<half 0xH7FFF> 0
t105: i64 = TargetConstantPool<half 0xH7FFF> 0
In function: __mulhc3
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: /home/andy/local/llvm18-assert/bin/clang -c reduced.ll -target x86_64-unknown-macosx11.7.1-unknown -Os
1. Code generation
2. Running pass 'Function Pass Manager' on module 'reduced.ll'.
3. Running pass 'X86 DAG->DAG Instruction Selection' on function '@<!-- -->__mulhc3'
#<!-- -->0 0x000000000387f1eb llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/andy/local/llvm18-assert/bin/clang+0x387f1eb)
#<!-- -->1 0x000000000387c54b llvm::sys::RunSignalHandlers() (/home/andy/local/llvm18-assert/bin/clang+0x387c54b)
#<!-- -->2 0x00000000037c1736 llvm::CrashRecoveryContext::HandleExit(int) (/home/andy/local/llvm18-assert/bin/clang+0x37c1736)
#<!-- -->3 0x000000000387665e llvm::sys::Process::Exit(int, bool) (/home/andy/local/llvm18-assert/bin/clang+0x387665e)
#<!-- -->4 0x0000000000b798f5 LLVMErrorHandler(void*, char const*, bool) cc1_main.cpp:0:0
#<!-- -->5 0x00000000037cda89 llvm::report_fatal_error(llvm::Twine const&, bool) (/home/andy/local/llvm18-assert/bin/clang+0x37cda89)
#<!-- -->6 0x0000000004993618 llvm::SelectionDAGISel::CannotYetSelect(llvm::SDNode*) (/home/andy/local/llvm18-assert/bin/clang+0x4993618)
#<!-- -->7 0x00000000049984ec llvm::SelectionDAGISel::SelectCodeCommon(llvm::SDNode*, unsigned char const*, unsigned int) (/home/andy/local/llvm18-assert/bin/clang+0x49984ec)
#<!-- -->8 0x0000000002403bd7 (anonymous namespace)::X86DAGToDAGISel::Select(llvm::SDNode*) X86ISelDAGToDAG.cpp:0:0
#<!-- -->9 0x000000000498e0b5 llvm::SelectionDAGISel::DoInstructionSelection() (/home/andy/local/llvm18-assert/bin/clang+0x498e0b5)
#<!-- -->10 0x000000000499c3a6 llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/home/andy/local/llvm18-assert/bin/clang+0x499c3a6)
#<!-- -->11 0x00000000049a00fc llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/home/andy/local/llvm18-assert/bin/clang+0x49a00fc)
#<!-- -->12 0x00000000049a1ca7 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (.part.0) SelectionDAGISel.cpp:0:0
#<!-- -->13 0x000000000240a325 (anonymous namespace)::X86DAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&) X86ISelDAGToDAG.cpp:0:0
#<!-- -->14 0x0000000002c30035 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0
#<!-- -->15 0x0000000003213329 llvm::FPPassManager::runOnFunction(llvm::Function&) (/home/andy/local/llvm18-assert/bin/clang+0x3213329)
#<!-- -->16 0x0000000003213461 llvm::FPPassManager::runOnModule(llvm::Module&) (/home/andy/local/llvm18-assert/bin/clang+0x3213461)
#<!-- -->17 0x0000000003213d67 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/home/andy/local/llvm18-assert/bin/clang+0x3213d67)
#<!-- -->18 0x0000000003aed923 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::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>, clang::BackendConsumer*) (/home/andy/local/llvm18-assert/bin/clang+0x3aed923)
#<!-- -->19 0x00000000040cca5a clang::CodeGenAction::ExecuteAction() (/home/andy/local/llvm18-assert/bin/clang+0x40cca5a)
#<!-- -->20 0x000000000434ac29 clang::FrontendAction::Execute() (/home/andy/local/llvm18-assert/bin/clang+0x434ac29)
#<!-- -->21 0x00000000042d0562 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/home/andy/local/llvm18-assert/bin/clang+0x42d0562)
#<!-- -->22 0x00000000044189cf clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/home/andy/local/llvm18-assert/bin/clang+0x44189cf)
#<!-- -->23 0x0000000000b7b6da cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/home/andy/local/llvm18-assert/bin/clang+0xb7b6da)
#<!-- -->24 0x0000000000b736b7 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#<!-- -->25 0x000000000410de69 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
#<!-- -->26 0x00000000037c1672 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/home/andy/local/llvm18-assert/bin/clang+0x37c1672)
#<!-- -->27 0x000000000410f554 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
#<!-- -->28 0x00000000040d6445 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/home/andy/local/llvm18-assert/bin/clang+0x40d6445)
#<!-- -->29 0x00000000040d6f3d clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/home/andy/local/llvm18-assert/bin/clang+0x40d6f3d)
#<!-- -->30 0x00000000040e1514 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/home/andy/local/llvm18-assert/bin/clang+0x40e1514)
#<!-- -->31 0x0000000000b78d79 clang_main(int, char**, llvm::ToolContext const&) (/home/andy/local/llvm18-assert/bin/clang+0xb78d79)
#<!-- -->32 0x0000000000a6fec3 main (/home/andy/local/llvm18-assert/bin/clang+0xa6fec3)
#<!-- -->33 0x00007f37fa23efce __libc_start_call_main (/nix/store/anlf335xlh41yjhm114swi87406mq5pw-glibc-2.38-44/lib/libc.so.6+0x27fce)
#<!-- -->34 0x00007f37fa23f089 __libc_start_main@<!-- -->GLIBC_2.2.5 (/nix/store/anlf335xlh41yjhm114swi87406mq5pw-glibc-2.38-44/lib/libc.so.6+0x28089)
#<!-- -->35 0x0000000000b72325 _start (/home/andy/local/llvm18-assert/bin/clang+0xb72325)
clang: error: clang frontend command failed with exit code 70 (use -v to see invocation)
clang version 18.1.5 (https://github.com/llvm/llvm-project 617a15a9eac96088ae5e9134248d8236e34b91b1)
Target: x86_64-unknown-macosx11.7.1-unknown
Thread model: posix
InstalledDir: /home/andy/local/llvm18-assert/bin
clang: note: diagnostic msg: Error generating preprocessed source(s) - no preprocessable inputs. Works fine with clang 17.0.6. |
@llvm/issue-subscribers-backend-x86 Author: Andrew Kelley (andrewrk)
version: 18.1.5
target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-macosx11.7.1-unknown"
%"compiler_rt.mulc3.Complex(f16)" = type { half, half }
; Function Attrs: minsize
define void @<!-- -->__mulhc3(ptr sret(%"compiler_rt.mulc3.Complex(f16)") %0, half %1, half %2, half %3, half %4) #<!-- -->0 {
%6 = call half @<!-- -->llvm.fabs.f16(half %1)
%7 = bitcast half %6 to i16
%8 = icmp eq i16 %7, 31744
%9 = call half @<!-- -->llvm.fabs.f16(half %2)
%10 = bitcast half %9 to i16
%11 = icmp eq i16 %10, 31744
%12 = select i1 %8, i1 true, i1 %11
br i1 %12, label %13, label %common.ret
common.ret: ; preds = %13, %5
ret void
13: ; preds = %5
%.1 = select i1 %11, half 0xH3C00, half 0xH0000
%14 = fmul half %.1, %2
%. = select i1 %8, half 0xH3C00, half 0xH0000
%15 = fmul half %., %1
%16 = fsub half %15, %14
store half %16, ptr %0, align 2
br label %common.ret
}
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare half @<!-- -->llvm.fabs.f16(half) #<!-- -->1
; uselistorder directives
uselistorder ptr @<!-- -->llvm.fabs.f16, { 1, 0 }
attributes #<!-- -->0 = { minsize "target-cpu"="ivybridge" }
attributes #<!-- -->1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } [nix-shell:~/src/zig/build-llvm18-release]$ ~/local/llvm18-assert/bin/clang -c reduced.ll -target x86_64-unknown-macosx11.7.1-unknown -Os
fatal error: error in backend: Cannot select: t98: v8f16,ch = X86ISD::VBROADCAST_LOAD<(load (s16) from constant-pool)> t0, t106
t106: i64 = X86ISD::WrapperRIP TargetConstantPool:i64<half 0xH7FFF> 0
t105: i64 = TargetConstantPool<half 0xH7FFF> 0
In function: __mulhc3
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: /home/andy/local/llvm18-assert/bin/clang -c reduced.ll -target x86_64-unknown-macosx11.7.1-unknown -Os
1. Code generation
2. Running pass 'Function Pass Manager' on module 'reduced.ll'.
3. Running pass 'X86 DAG->DAG Instruction Selection' on function '@<!-- -->__mulhc3'
#<!-- -->0 0x000000000387f1eb llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/andy/local/llvm18-assert/bin/clang+0x387f1eb)
#<!-- -->1 0x000000000387c54b llvm::sys::RunSignalHandlers() (/home/andy/local/llvm18-assert/bin/clang+0x387c54b)
#<!-- -->2 0x00000000037c1736 llvm::CrashRecoveryContext::HandleExit(int) (/home/andy/local/llvm18-assert/bin/clang+0x37c1736)
#<!-- -->3 0x000000000387665e llvm::sys::Process::Exit(int, bool) (/home/andy/local/llvm18-assert/bin/clang+0x387665e)
#<!-- -->4 0x0000000000b798f5 LLVMErrorHandler(void*, char const*, bool) cc1_main.cpp:0:0
#<!-- -->5 0x00000000037cda89 llvm::report_fatal_error(llvm::Twine const&, bool) (/home/andy/local/llvm18-assert/bin/clang+0x37cda89)
#<!-- -->6 0x0000000004993618 llvm::SelectionDAGISel::CannotYetSelect(llvm::SDNode*) (/home/andy/local/llvm18-assert/bin/clang+0x4993618)
#<!-- -->7 0x00000000049984ec llvm::SelectionDAGISel::SelectCodeCommon(llvm::SDNode*, unsigned char const*, unsigned int) (/home/andy/local/llvm18-assert/bin/clang+0x49984ec)
#<!-- -->8 0x0000000002403bd7 (anonymous namespace)::X86DAGToDAGISel::Select(llvm::SDNode*) X86ISelDAGToDAG.cpp:0:0
#<!-- -->9 0x000000000498e0b5 llvm::SelectionDAGISel::DoInstructionSelection() (/home/andy/local/llvm18-assert/bin/clang+0x498e0b5)
#<!-- -->10 0x000000000499c3a6 llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/home/andy/local/llvm18-assert/bin/clang+0x499c3a6)
#<!-- -->11 0x00000000049a00fc llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/home/andy/local/llvm18-assert/bin/clang+0x49a00fc)
#<!-- -->12 0x00000000049a1ca7 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (.part.0) SelectionDAGISel.cpp:0:0
#<!-- -->13 0x000000000240a325 (anonymous namespace)::X86DAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&) X86ISelDAGToDAG.cpp:0:0
#<!-- -->14 0x0000000002c30035 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0
#<!-- -->15 0x0000000003213329 llvm::FPPassManager::runOnFunction(llvm::Function&) (/home/andy/local/llvm18-assert/bin/clang+0x3213329)
#<!-- -->16 0x0000000003213461 llvm::FPPassManager::runOnModule(llvm::Module&) (/home/andy/local/llvm18-assert/bin/clang+0x3213461)
#<!-- -->17 0x0000000003213d67 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/home/andy/local/llvm18-assert/bin/clang+0x3213d67)
#<!-- -->18 0x0000000003aed923 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::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>, clang::BackendConsumer*) (/home/andy/local/llvm18-assert/bin/clang+0x3aed923)
#<!-- -->19 0x00000000040cca5a clang::CodeGenAction::ExecuteAction() (/home/andy/local/llvm18-assert/bin/clang+0x40cca5a)
#<!-- -->20 0x000000000434ac29 clang::FrontendAction::Execute() (/home/andy/local/llvm18-assert/bin/clang+0x434ac29)
#<!-- -->21 0x00000000042d0562 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/home/andy/local/llvm18-assert/bin/clang+0x42d0562)
#<!-- -->22 0x00000000044189cf clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/home/andy/local/llvm18-assert/bin/clang+0x44189cf)
#<!-- -->23 0x0000000000b7b6da cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/home/andy/local/llvm18-assert/bin/clang+0xb7b6da)
#<!-- -->24 0x0000000000b736b7 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#<!-- -->25 0x000000000410de69 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
#<!-- -->26 0x00000000037c1672 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/home/andy/local/llvm18-assert/bin/clang+0x37c1672)
#<!-- -->27 0x000000000410f554 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
#<!-- -->28 0x00000000040d6445 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/home/andy/local/llvm18-assert/bin/clang+0x40d6445)
#<!-- -->29 0x00000000040d6f3d clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/home/andy/local/llvm18-assert/bin/clang+0x40d6f3d)
#<!-- -->30 0x00000000040e1514 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/home/andy/local/llvm18-assert/bin/clang+0x40e1514)
#<!-- -->31 0x0000000000b78d79 clang_main(int, char**, llvm::ToolContext const&) (/home/andy/local/llvm18-assert/bin/clang+0xb78d79)
#<!-- -->32 0x0000000000a6fec3 main (/home/andy/local/llvm18-assert/bin/clang+0xa6fec3)
#<!-- -->33 0x00007f37fa23efce __libc_start_call_main (/nix/store/anlf335xlh41yjhm114swi87406mq5pw-glibc-2.38-44/lib/libc.so.6+0x27fce)
#<!-- -->34 0x00007f37fa23f089 __libc_start_main@<!-- -->GLIBC_2.2.5 (/nix/store/anlf335xlh41yjhm114swi87406mq5pw-glibc-2.38-44/lib/libc.so.6+0x28089)
#<!-- -->35 0x0000000000b72325 _start (/home/andy/local/llvm18-assert/bin/clang+0xb72325)
clang: error: clang frontend command failed with exit code 70 (use -v to see invocation)
clang version 18.1.5 (https://github.com/llvm/llvm-project 617a15a9eac96088ae5e9134248d8236e34b91b1)
Target: x86_64-unknown-macosx11.7.1-unknown
Thread model: posix
InstalledDir: /home/andy/local/llvm18-assert/bin
clang: note: diagnostic msg: Error generating preprocessed source(s) - no preprocessable inputs. Works fine with clang 17.0.6. |
phoebewang
added a commit
to phoebewang/llvm-project
that referenced
this issue
May 5, 2024
AVX doesn't provide 16-bit BROADCAST instruction. Fixes llvm#91005
The root cause is a long existing bug https://godbolt.org/z/35zd9dx68, which just exposed by LLVM 18 optimization. Should be fixed by #91125. |
phoebewang
added a commit
that referenced
this issue
May 6, 2024
AVX doesn't provide 16-bit BROADCAST instruction. Fixes #91005
llvmbot
pushed a commit
to llvmbot/llvm-project
that referenced
this issue
May 6, 2024
…91125) AVX doesn't provide 16-bit BROADCAST instruction. Fixes llvm#91005 (cherry picked from commit f7bfb07)
phoebewang
added a commit
to phoebewang/llvm-project
that referenced
this issue
May 8, 2024
…91125) AVX doesn't provide 16-bit BROADCAST instruction. Fixes llvm#91005
tstellar
pushed a commit
to phoebewang/llvm-project
that referenced
this issue
May 9, 2024
…91125) AVX doesn't provide 16-bit BROADCAST instruction. Fixes llvm#91005
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
version: 18.1.5
Works fine with clang 17.0.6.
The text was updated successfully, but these errors were encountered: