Skip to content

[SystemZ] Crash with SystemZConvCC intrinsics #141653

Closed
@sayantn

Description

@sayantn

When this IR is compiled

define void @foo(ptr dead_on_unwind noalias nocapture noundef writable writeonly sret([24 x i8]) align 8 dereferenceable(24) initializes((0, 20)) %_0, ptr noalias nocapture noundef readonly align 8 dereferenceable(16) %a, ptr noalias nocapture noundef readonly align 8 dereferenceable(16) %b, ptr noalias nocapture noundef readonly align 8 dereferenceable(16) %c) unnamed_addr #0 {
start:
  %0 = load <16 x i8>, ptr %a, align 8
  %1 = load <16 x i8>, ptr %b, align 8
  %2 = load <16 x i8>, ptr %c, align 8
  %3 = tail call { <16 x i8>, i32 } @llvm.s390.vstrsb(<16 x i8> %0, <16 x i8> %1, <16 x i8> %2) #2
  %4 = extractvalue { <16 x i8>, i32 } %3, 0
  %5 = extractvalue { <16 x i8>, i32 } %3, 1
  store <16 x i8> %4, ptr %_0, align 8
  %6 = getelementptr inbounds nuw i8, ptr %_0, i64 16
  store i32 %5, ptr %6, align 8
  ret void
}

declare { <16 x i8>, i32 } @llvm.s390.vstrsb(<16 x i8>, <16 x i8>, <16 x i8>) #1

attributes #0 = { nofree nosync nounwind memory(argmem: readwrite) uwtable "probe-stack"="inline-asm" "target-cpu"="z10" "target-features"="+vector" }
attributes #1 = { nofree nosync nounwind memory(none) }
attributes #2 = { nounwind }

llc -march=systemz crashes with

LLVM ERROR: Cannot select: 0x3dcc0ab8: v16i8,i32 = SystemZISD::VSTRS_CC 0x3dcc0860, 0x3dcc08d8, 0x3dcc0950
  0x3dcc0860: v16i8,ch = load<(dereferenceable load (s128) from %ir.a, align 8)> 0x3dc91c30, 0x3dcc0518, undef:i64
    0x3dcc0518: i64,ch = CopyFromReg 0x3dc91c30, Register:i64 %1
      0x3dcc04a0: i64 = Register %1
    0x3dcc07e8: i64 = undef
  0x3dcc08d8: v16i8,ch = load<(dereferenceable load (s128) from %ir.b, align 8)> 0x3dc91c30, 0x3dcc0608, undef:i64
    0x3dcc0608: i64,ch = CopyFromReg 0x3dc91c30, Register:i64 %2
      0x3dcc0590: i64 = Register %2
    0x3dcc07e8: i64 = undef
  0x3dcc0950: v16i8,ch = load<(dereferenceable load (s128) from %ir.c, align 8)> 0x3dc91c30, 0x3dcc06f8, undef:i64
    0x3dcc06f8: i64,ch = CopyFromReg 0x3dc91c30, Register:i64 %3
      0x3dcc0680: i64 = Register %3
    0x3dcc07e8: i64 = undef
In function: foo
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.	Program arguments: /opt/compiler-explorer/clang-trunk/bin/llc -o /app/output.s -x86-asm-syntax=intel -march=systemz <source>
1.	Running pass 'Function Pass Manager' on module '<source>'.
2.	Running pass 'SystemZ DAG->DAG Pattern Instruction Selection' on function '@foo'
 #0 0x0000000003b784b8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-trunk/bin/llc+0x3b784b8)
 #1 0x0000000003b76074 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
 #2 0x00007f1bcd242520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #3 0x00007f1bcd2969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #4 0x00007f1bcd242476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #5 0x00007f1bcd2287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #6 0x00000000007895f0 llvm::UniqueStringSaver::save(llvm::Twine const&) (.cold) StringSaver.cpp:0:0
 #7 0x000000000391dcca llvm::SelectionDAGISel::CannotYetSelect(llvm::SDNode*) (/opt/compiler-explorer/clang-trunk/bin/llc+0x391dcca)
 #8 0x0000000003924039 llvm::SelectionDAGISel::SelectCodeCommon(llvm::SDNode*, unsigned char const*, unsigned int) (/opt/compiler-explorer/clang-trunk/bin/llc+0x3924039)
 #9 0x0000000001d209d8 (anonymous namespace)::SystemZDAGToDAGISel::Select(llvm::SDNode*) SystemZISelDAGToDAG.cpp:0:0
#10 0x000000000391b1a4 llvm::SelectionDAGISel::DoInstructionSelection() (/opt/compiler-explorer/clang-trunk/bin/llc+0x391b1a4)
#11 0x0000000003929cb2 llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/opt/compiler-explorer/clang-trunk/bin/llc+0x3929cb2)
#12 0x000000000392c62a llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x392c62a)
#13 0x000000000392e506 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x392e506)
#14 0x0000000001d22efa (anonymous namespace)::SystemZDAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&) SystemZISelDAGToDAG.cpp:0:0
#15 0x000000000391ad21 llvm::SelectionDAGISelLegacy::runOnMachineFunction(llvm::MachineFunction&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x391ad21)
#16 0x0000000002bdef28 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0
#17 0x000000000315e112 llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x315e112)
#18 0x000000000315e3a1 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x315e3a1)
#19 0x000000000315fd09 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x315fd09)
#20 0x00000000008c4bef compileModule(char**, llvm::LLVMContext&) llc.cpp:0:0
#21 0x000000000079edde main (/opt/compiler-explorer/clang-trunk/bin/llc+0x79edde)
#22 0x00007f1bcd229d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#23 0x00007f1bcd229e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#24 0x00000000008bc6b5 _start (/opt/compiler-explorer/clang-trunk/bin/llc+0x8bc6b5)
Program terminated with signal: SIGSEGV
Compiler returned: 139

Godbolt (also contains the Rust code that generated this IR)

Metadata

Metadata

Assignees

No one assigned

    Labels

    backend:SystemZquestionA question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions