Skip to content

powerpc64le: ICE during instruction selection #110753

@tuliom

Description

@tuliom

This issue was originally reported against Fedora.

I was able to reduce it to:

The C source code is:

#define simde_math_roundeven(v) __builtin_roundeven(v)
#define SIMDE_VECTOR(size) __attribute__((__vector_size__(size)))

typedef double simde_float64;
typedef struct {
  simde_float64 f64 SIMDE_VECTOR(64);
} simde__m512d_private;

simde__m512d_private __trans_tmp_4, test_simde_x_mm512_round_pd_r_;

void simde__m512d_from_private();

void test_simde_x_mm512_round_pd() {
  for (int i;;) {
    simde__m512d_private a_ = __trans_tmp_4;
    i = 0;
    for (; i < sizeof(test_simde_x_mm512_round_pd_r_.f64[0]); i++)
      test_simde_x_mm512_round_pd_r_.f64[i] = simde_math_roundeven(a_.f64[i]);
    simde__m512d_from_private();
  }
}

The issue can be reproduced with the command: clang -O2 round-reduced.c

The error message is:

LLVM ERROR: Cannot select: 0x9b8fd80: v2f64 = froundeven 0x9b8ef10
  0x9b8ef10: v2f64,ch = PPCISD::XXSWAPD 0x9b92d00:1, 0x9b92d00
    0x9b92d00: v2f64,ch = PPCISD::LXVD2X<(dereferenceable load (s128) from @__trans_tmp_4 + 48, basealign 64)> 0x9b07a90, 0x9b92910
      0x9b92910: i64 = add nuw 0x9b8f1b0, Constant:i64<48>
        0x9b8f1b0: i64,ch = PPCISD::TOC_ENTRY<(load (s64) from got)> TargetGlobalAddress:i64<ptr @__trans_tmp_4> 0, Register:i64 $x2
          0x9b8f0d0: i64 = TargetGlobalAddress<ptr @__trans_tmp_4> 0
          0x9b8f450: i64 = Register $x2
        0x9b8eff0: i64 = Constant<48>
In function: _Z27test_simde_x_mm512_round_pdv
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 -mtriple=powerpc64le-linux <source>
1.	Running pass 'Function Pass Manager' on module '<source>'.
2.	Running pass 'PowerPC DAG->DAG Pattern Instruction Selection' on function '@_Z27test_simde_x_mm512_round_pdv'
 #0 0x00000000038a5c18 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-trunk/bin/llc+0x38a5c18)
 #1 0x00000000038a37fc SignalHandler(int) Signals.cpp:0:0
 #2 0x000078581ec42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #3 0x000078581ec969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #4 0x000078581ec42476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #5 0x000078581ec287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #6 0x000000000074cf34 llvm::UniqueStringSaver::save(llvm::Twine const&) (.cold) StringSaver.cpp:0:0
 #7 0x000000000365c78c llvm::SelectionDAGISel::CannotYetSelect(llvm::SDNode*) (/opt/compiler-explorer/clang-trunk/bin/llc+0x365c78c)
 #8 0x0000000003663755 llvm::SelectionDAGISel::SelectCodeCommon(llvm::SDNode*, unsigned char const*, unsigned int) (/opt/compiler-explorer/clang-trunk/bin/llc+0x3663755)
 #9 0x0000000001826182 (anonymous namespace)::PPCDAGToDAGISel::Select(llvm::SDNode*) PPCISelDAGToDAG.cpp:0:0
#10 0x0000000003659cd4 llvm::SelectionDAGISel::DoInstructionSelection() (/opt/compiler-explorer/clang-trunk/bin/llc+0x3659cd4)
#11 0x0000000003668ea1 llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/opt/compiler-explorer/clang-trunk/bin/llc+0x3668ea1)
#12 0x000000000366b9dc llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x366b9dc)
#13 0x000000000366d63f llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x366d63f)
#14 0x000000000182c987 (anonymous namespace)::PPCDAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&) PPCISelDAGToDAG.cpp:0:0
#15 0x0000000003659861 llvm::SelectionDAGISelLegacy::runOnMachineFunction(llvm::MachineFunction&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x3659861)
#16 0x000000000295896b llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0
#17 0x0000000002ea8f32 llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x2ea8f32)
#18 0x0000000002ea91c1 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x2ea91c1)
#19 0x0000000002eaab66 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x2eaab66)
#20 0x0000000000870854 compileModule(char**, llvm::LLVMContext&) llc.cpp:0:0
#21 0x0000000000761086 main (/opt/compiler-explorer/clang-trunk/bin/llc+0x761086)
#22 0x000078581ec29d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#23 0x000078581ec29e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#24 0x00000000008685fe _start (/opt/compiler-explorer/clang-trunk/bin/llc+0x8685fe)
Program terminated with signal: SIGSEGV
Compiler returned: 139

Metadata

Metadata

Assignees

Labels

crashPrefer [crash-on-valid] or [crash-on-invalid]llvm:SelectionDAGSelectionDAGISel as well

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions