Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

ICE in backend for sapphirerapids: Cannot select: t60: v8i16 = X86ISD::VZEXT_MOVL t55 #51527

Closed Quuxplusone closed 3 years ago

Quuxplusone commented 3 years ago
Bugzilla Link PR52560
Status RESOLVED FIXED
Importance P enhancement
Reported by Vsevolod Livinskiy (Vsevolod.Livinskij@frtk.ru)
Reported on 2021-11-19 09:35:18 -0800
Last modified on 2021-11-21 18:59:09 -0800
Version trunk
Hardware PC Linux
CC babokin@gmail.com, craig.topper@gmail.com, llvm-bugs@lists.llvm.org, llvm-dev@redking.me.uk, pengfei.wang@intel.com, regehr@cs.utah.edu, spatel+llvm@rotateright.com, Vsevolod.Livinskij@frtk.ru
Fixed by commit(s) rG6cc820a3e284cfd5f4d7f1c329e3c8eafb5fb5c3
Attachments
Blocks
Blocked by
See also
Link to the Compiler Explorer: https://godbolt.org/z/zz5bdq8c6

LLVM IR Reproducer:

define void @_Z1hv(i8 %0, <2 x i16> %1, i8* %c) local_unnamed_addr {
entry:
  %conv = sext i8 %0 to i16
  %2 = insertelement <2 x i16> zeroinitializer, i16 %conv, i32 0
  %3 = icmp sgt <2 x i16> %2, zeroinitializer
  %4 = select <2 x i1> %3, <2 x i16> %1, <2 x i16> zeroinitializer
  %5 = extractelement <2 x i16> %4, i32 0
  %tobool.not14 = icmp eq i16 %5, 0
  br i1 %tobool.not14, label %for.end, label %for.body.preheader

for.body.preheader:                               ; preds = %entry
  store i8 0, i8* %c, align 1
  br label %for.end

for.end:                                          ; preds =
%for.body.preheader, %entry
  ret void
}

Error:
>$ clang++ -c -O1 -march=sapphirerapids reduced.ll
fatal error: error in backend: Cannot select: t60: v8i16 = X86ISD::VZEXT_MOVL
t55
  t55: v8i16 = scalar_to_vector t31
    t31: i16 = sign_extend_inreg t29, ValueType:ch:i8
      t29: i16 = truncate t2
        t2: i32,ch = CopyFromReg t0, Register:i32 %0
          t1: i32 = Register %0
In function: _Z1hv
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash
backtrace, preprocessed source, and associated run script.
Stack dump:
0.  Program arguments: clang++ -c -O1 -march=sapphirerapids reduced.ll
1.  Code generation
2.  Running pass 'Function Pass Manager' on module 'reduced.ll'.
3.  Running pass 'X86 DAG->DAG Instruction Selection' on function '@_Z1hv'
 #0 0x0000556a5e65f115 PrintStackTraceSignalHandler(void*) Signals.cpp:0:0
 #1 0x0000556a5e65cd64 llvm::sys::CleanupOnSignal(unsigned long) (/testing/llvm/bin_main/bin/clang-14+0x222bd64)
 #2 0x0000556a5e5a9293 llvm::CrashRecoveryContext::HandleExit(int) (/testing/llvm/bin_main/bin/clang-14+0x2178293)
 #3 0x0000556a5e654a92 llvm::sys::Process::Exit(int, bool) (/testing/llvm/bin_main/bin/clang-14+0x2223a92)
 #4 0x0000556a5d0cc4c8 LLVMErrorHandler(void*, char const*, bool) cc1_main.cpp:0:0
 #5 0x0000556a5e5b17fa llvm::report_fatal_error(llvm::Twine const&, bool) (/testing/llvm/bin_main/bin/clang-14+0x21807fa)
 #6 0x0000556a5f6b8f41 llvm::SelectionDAGISel::CannotYetSelect(llvm::SDNode*) (/testing/llvm/bin_main/bin/clang-14+0x3287f41)
 #7 0x0000556a5f6ba5d2 llvm::SelectionDAGISel::SelectCodeCommon(llvm::SDNode*, unsigned char const*, unsigned int) (/testing/llvm/bin_main/bin/clang-14+0x32895d2)
 #8 0x0000556a5d1c1d57 (anonymous namespace)::X86DAGToDAGISel::Select(llvm::SDNode*) X86ISelDAGToDAG.cpp:0:0
 #9 0x0000556a5f6b6e3a llvm::SelectionDAGISel::DoInstructionSelection() (/testing/llvm/bin_main/bin/clang-14+0x3285e3a)
#10 0x0000556a5f6c1699 llvm::SelectionDAGISel::CodeGenAndEmitDAG()
(/testing/llvm/bin_main/bin/clang-14+0x3290699)
#11 0x0000556a5f6c50ef
llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&)
(/testing/llvm/bin_main/bin/clang-14+0x32940ef)
#12 0x0000556a5f6c6fb1
llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (.part.0)
SelectionDAGISel.cpp:0:0
#13 0x0000556a5d1cc910 (anonymous
namespace)::X86DAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&)
X86ISelDAGToDAG.cpp:0:0
#14 0x0000556a5d86c758
llvm::MachineFunctionPass::runOnFunction(llvm::Function&)
(/testing/llvm/bin_main/bin/clang-14+0x143b758)
#15 0x0000556a5dde9593 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/testing/llvm/bin_main/bin/clang-14+0x19b8593)
#16 0x0000556a5dde97c9 llvm::FPPassManager::runOnModule(llvm::Module&)
(/testing/llvm/bin_main/bin/clang-14+0x19b87c9)
#17 0x0000556a5ddea0e5 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/testing/llvm/bin_main/bin/clang-14+0x19b90e5)
#18 0x0000556a5e9a08b3 clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::HeaderSearchOptions const&, clang::CodeGenOptions const&,
clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef,
llvm::Module*, clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >)
(/testing/llvm/bin_main/bin/clang-14+0x256f8b3)
#19 0x0000556a5f805c38 clang::CodeGenAction::ExecuteAction()
(/testing/llvm/bin_main/bin/clang-14+0x33d4c38)
#20 0x0000556a5f0ac389 clang::FrontendAction::Execute()
(/testing/llvm/bin_main/bin/clang-14+0x2c7b389)
#21 0x0000556a5f0394de
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/testing/llvm/bin_main/bin/clang-14+0x2c084de)
#22 0x0000556a5f174ed8
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/testing/llvm/bin_main/bin/clang-14+0x2d43ed8)
#23 0x0000556a5d0cd181 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/testing/llvm/bin_main/bin/clang-14+0xc9c181)
#24 0x0000556a5d0c8de4 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&)
driver.cpp:0:0
#25 0x0000556a5eec3699 void llvm::function_ref<void
()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>
>, std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >*, bool*) const::'lambda'()>(long) Job.cpp:0:0
#26 0x0000556a5e5a915c
llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>)
(/testing/llvm/bin_main/bin/clang-14+0x217815c)
#27 0x0000556a5eec3fbc
clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>
>, std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >*, bool*) const (.part.0) Job.cpp:0:0
#28 0x0000556a5ee95952
clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&,
clang::driver::Command const*&) const (/testing/llvm/bin_main/bin/clang-
14+0x2a64952)
#29 0x0000556a5ee964f9
clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) const
(/testing/llvm/bin_main/bin/clang-14+0x2a654f9)
#30 0x0000556a5eea41a9
clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&)
(/testing/llvm/bin_main/bin/clang-14+0x2a731a9)
#31 0x0000556a5d047401 main (/testing/llvm/bin_main/bin/clang-14+0xc16401)
#32 0x00007f882b278fd0 (/lib/x86_64-linux-gnu/libc.so.6+0x2dfd0)
#33 0x00007f882b27907d __libc_start_main (/lib/x86_64-linux-
gnu/libc.so.6+0x2e07d)
#34 0x0000556a5d0c8765 _start (/testing/llvm/bin_main/bin/clang-14+0xc97765)
clang-14: error: clang frontend command failed with exit code 70 (use -v to see
invocation)
clang version 14.0.0 (https://github.com/llvm/llvm-project.git
8fb3f84484094230d563c1e4c1088755b7cde15b)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /testing/llvm/bin_main/bin

C++ Reproducer:
char a;
extern short b[];
bool c;

const short &d(const short &e, short &f) {
  if (f < e)
    return f;
  return e;
}

short g(const short &e, short f) {
  if (e < f)
    return f;
  return e;
}

void h() {
  for (; g(d(0, b[5]), d(a, b[4]));)
    c = 0;
}

Error:
>$ clang++ -c -fopenmp-simd -O2 -march=sapphirerapids func.cpp
Quuxplusone commented 3 years ago

Thanks for reporting it. Candidate patch: https://reviews.llvm.org/D114313