Issue 175802
Summary [X86] X86ISelLowering crashed in isHorizontalBinOp
Labels backend:X86, crash-on-valid
Assignees
Reporter XChy
    Reproducer: https://godbolt.org/z/GjcjETY75
Testcase:
```llvm
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 <16 x i32> @func_1() #0 {
entry:
  %0 = tail call <8 x i16> @llvm.x86.sse2.pavg.w(<8 x i16> undef, <8 x i16> undef)
  %1 = bitcast <8 x i16> %0 to <4 x i32>
  %shift = shufflevector <4 x i32> %1, <4 x i32> zeroinitializer, <4 x i32> <i32 poison, i32 2, i32 poison, i32 poison>
  %foldExtExtBinop = add <4 x i32> %shift, %1
  %2 = shufflevector <4 x i32> %foldExtExtBinop, <4 x i32> zeroinitializer, <16 x i32> <i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison>
  ret <16 x i32> %2
}

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(none)
declare <8 x i16> @llvm.x86.sse2.pavg.w(<8 x i16>, <8 x i16>) #1

attributes #0 = { "target-features"="+avx2" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(none) }
```

Dump:
```
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 <source>
1.	Running pass 'Function Pass Manager' on module '<source>'.
2.	Running pass 'X86 DAG->DAG Instruction Selection' on function '@func_1'
 #0 0x0000000004252078 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x4252078)
 #1 0x000000000424ef34 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
 #2 0x0000739b54642520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #3 0x00000000024c7dc2 isHorizontalBinOp(unsigned int, llvm::SDValue&, llvm::SDValue&, llvm::SelectionDAG&, llvm::X86Subtarget const&, bool, llvm::SmallVectorImpl<int>&, bool) X86ISelLowering.cpp:0:0
 #4 0x00000000024c8122 combineToHorizontalAddSub(llvm::SDNode*, llvm::SelectionDAG&, llvm::X86Subtarget const&) X86ISelLowering.cpp:0:0
 #5 0x00000000024fd3dd combineAdd(llvm::SDNode*, llvm::SelectionDAG&, llvm::TargetLowering::DAGCombinerInfo&, llvm::X86Subtarget const&) (.isra.0) X86ISelLowering.cpp:0:0
 #6 0x0000000002526f4c llvm::X86TargetLowering::PerformDAGCombine(llvm::SDNode*, llvm::TargetLowering::DAGCombinerInfo&) const (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x2526f4c)
 #7 0x0000000003e71d1f (anonymous namespace)::DAGCombiner::combine(llvm::SDNode*) DAGCombiner.cpp:0:0
 #8 0x0000000003e737a0 (anonymous namespace)::DAGCombiner::Run(llvm::CombineLevel) DAGCombiner.cpp:0:0
 #9 0x0000000003e761f3 llvm::SelectionDAG::Combine(llvm::CombineLevel, llvm::BatchAAResults*, llvm::CodeGenOptLevel) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3e761f3)
#10 0x0000000003fe3115 llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3fe3115)
#11 0x0000000003fe61d8 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3fe61d8)
#12 0x0000000003fe7cec llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3fe7cec)
#13 0x0000000003fd2f5f llvm::SelectionDAGISelLegacy::runOnMachineFunction(llvm::MachineFunction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3fd2f5f)
#14 0x000000000311f679 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0
#15 0x0000000003774f86 llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3774f86)
#16 0x0000000003775331 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3775331)
#17 0x0000000003775b9f llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3775b9f)
#18 0x00000000008ea1dd compileModule(char**, llvm::SmallVectorImpl<llvm::PassPlugin>&, llvm::LLVMContext&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&) llc.cpp:0:0
#19 0x00000000007c5e2c main (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x7c5e2c)
#20 0x0000739b54629d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#21 0x0000739b54629e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#22 0x00000000008df275 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x8df275)
Program terminated with signal: SIGSEGV
Compiler returned: 139
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to