Skip to content

[X86] llc crashed at O1/O2/O3 and asserted "Cannot BITCAST between types of different sizes!" #164107

@XChy

Description

@XChy

Reproducer: https://godbolt.org/z/v77zoxcv6
Testcase:

target datalayout = "e-m:e-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-linux-gnu"

define i32 @func_1(<16 x i1> %0) #0 {
entry:
  %cmp = shufflevector <16 x i1> %0, <16 x i1> zeroinitializer, <16 x i32> zeroinitializer
  %sext = sext <16 x i1> %cmp to <16 x i64>
  %1 = bitcast <16 x i64> %sext to <64 x i16>
  %vecinit15.i = shufflevector <64 x i16> %1, <64 x i16> zeroinitializer, <16 x i32> <i32 56, i32 56, i32 56, i32 56, i32 56, i32 56, i32 56, i32 56, i32 56, i32 56, i32 56, i32 56, i32 56, i32 56, i32 56, i32 56>
  %conv16.i = sext <16 x i16> %vecinit15.i to <16 x i64>
  %2 = bitcast <16 x i64> %conv16.i to <32 x i32>
  %conv22.i = extractelement <32 x i32> %2, i64 4
  ret i32 %conv22.i
}

attributes #0 = { "target-features"="+avx" }

llc error:

llc: /root/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:6749: llvm::SDValue llvm::SelectionDAG::getNode(unsigned int, const llvm::SDLoc&, llvm::EVT, llvm::SDValue, llvm::SDNodeFlags): Assertion `VT.getSizeInBits() == N1.getValueSizeInBits() && "Cannot BITCAST between types of different sizes!"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.
Stack dump:
0.	Program arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/llc -o /app/output.s -x86-asm-syntax=intel -O1 <source>
1.	Running pass 'Function Pass Manager' on module '<source>'.
2.	Running pass 'X86 DAG->DAG Instruction Selection' on function '@func_1'
 #0 0x0000000004166dd8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x4166dd8)
 #1 0x0000000004163c84 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
 #2 0x00007645ba642520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #3 0x00007645ba6969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #4 0x00007645ba642476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #5 0x00007645ba6287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #6 0x00007645ba62871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
 #7 0x00007645ba639e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
 #8 0x0000000003eae8cd llvm::SelectionDAG::getNode(unsigned int, llvm::SDLoc const&, llvm::EVT, llvm::SDValue, llvm::SDNodeFlags) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3eae8cd)
 #9 0x0000000003eb0bbd llvm::SelectionDAG::getBitcast(llvm::EVT, llvm::SDValue) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3eb0bbd)
#10 0x0000000003d4a1d0 (anonymous namespace)::DAGCombiner::visitVECTOR_SHUFFLE(llvm::SDNode*) DAGCombiner.cpp:0:0
#11 0x0000000003d875ef (anonymous namespace)::DAGCombiner::visit(llvm::SDNode*) DAGCombiner.cpp:0:0
#12 0x0000000003d88d7c (anonymous namespace)::DAGCombiner::combine(llvm::SDNode*) DAGCombiner.cpp:0:0
#13 0x0000000003d8a7ed (anonymous namespace)::DAGCombiner::Run(llvm::CombineLevel) DAGCombiner.cpp:0:0
#14 0x0000000003d8d353 llvm::SelectionDAG::Combine(llvm::CombineLevel, llvm::BatchAAResults*, llvm::CodeGenOptLevel) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3d8d353)
#15 0x0000000003ef6ff4 llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3ef6ff4)
#16 0x0000000003efacbd llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3efacbd)
#17 0x0000000003efc2a5 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3efc2a5)
#18 0x0000000003ee7aaf llvm::SelectionDAGISelLegacy::runOnMachineFunction(llvm::MachineFunction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3ee7aaf)
#19 0x00000000030547b9 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0
#20 0x00000000036a2a88 llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x36a2a88)
#21 0x00000000036a2cc1 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x36a2cc1)
#22 0x00000000036a352f llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x36a352f)
#23 0x00000000008f5a49 compileModule(char**, llvm::LLVMContext&) llc.cpp:0:0
#24 0x00000000007c3ba6 main (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x7c3ba6)
#25 0x00007645ba629d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#26 0x00007645ba629e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#27 0x00000000008eb085 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x8eb085)
Program terminated with signal: SIGSEGV
Compiler returned: 139

cc @RKSimon @phoebewang

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions