<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/111170>111170</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [X86] [ISEL] Assertion hits in PerformDAGCombine/combineMul
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          nurmukhametov
      </td>
    </tr>
</table>

<pre>
    Consider the following code

```asm
target datalayout = "e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32-a:0:32-S32"
target triple = "i686-pc-windows-msvc"

define void @f_fu___un_3C_unf_3E_vyi(<16 x i32> %x_load, ptr %offsetsPtr.i) {
allocas:
  %mul__x_load = mul <16 x i32> <i32 20, i32 20, i32 20, i32 20, i32 20, i32 20, i32 20, i32 20, i32 20, i32 20, i32 20, i32 20, i32 20, i32 20, i32 20, i32 20>, %x_load
  store <16 x i32> %mul__x_load, ptr %offsetsPtr.i, align 4
  %blend1.i12.i = call <8 x float> @llvm.x86.avx.blendv.ps.256(<8 x float> zeroinitializer, <8 x float> <float 0x36E4000000000000, float 0x36E4000000000000, float 0x36E4000000000000, float 0x36E4000000000000, float 0x36E4000000000000, float 0x36E4000000000000, float 0x36E4000000000000, float 0x36E4000000000000>, <8 x float> zeroinitializer)
  %blend.i13.i = shufflevector <8 x float> zeroinitializer, <8 x float> %blend1.i12.i, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>
  %blendAsInt.i14.i = bitcast <16 x float> %blend.i13.i to <16 x i32>
  store <16 x i32> %blendAsInt.i14.i, ptr null, align 4
  ret void
}

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(none)
declare <8 x float> @llvm.x86.avx.blendv.ps.256(<8 x float>, <8 x float>, <8 x float>) #0

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(none) }

```

that hits Assertion when compiled with the following command
```bash
$ llc test.ll -mcpu=corei7-avx -march=x86

llc: /root/llvm-project/llvm/lib/IR/Constants.cpp:1689: llvm::Constant* llvm::Constant::getSplatValue(bool) const: Assertion `this->getType()->isVectorTy() && "Only valid for vectors!"' failed.
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-assertions-trunk/bin/llc -o /app/output.s -x86-asm-syntax=intel -mcpu=corei7-avx -march=x86 <source>
1.      Running pass 'Function Pass Manager' on module '<source>'.
2.      Running pass 'X86 DAG->DAG Instruction Selection' on function '@f_fu___un_3C_unf_3E_vyi'
 #0 0x0000000003b5d748 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3b5d748)
 #1 0x0000000003b5b0fc SignalHandler(int) Signals.cpp:0:0
 #2 0x000070dc43242520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #3 0x000070dc432969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #4 0x000070dc43242476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #5 0x000070dc432287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #6 0x000070dc4322871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
 #7 0x000070dc43239e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
 #8 0x0000000002fd5d3f llvm::Constant::getSplatValue(bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x2fd5d3f)
 #9 0x0000000002fd6b63 llvm::Constant::getUniqueInteger() const (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x2fd6b63)
#10 0x000000000202ac8e combineMul(llvm::SDNode*, llvm::SelectionDAG&, llvm::TargetLowering::DAGCombinerInfo&, llvm::X86Subtarget const&) X86ISelLowering.cpp:0:0
#11 0x00000000020cdf4a llvm::X86TargetLowering::PerformDAGCombine(llvm::SDNode*, llvm::TargetLowering::DAGCombinerInfo&) const (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x20cdf4a)
#12 0x00000000037b0c41 (anonymous namespace)::DAGCombiner::combine(llvm::SDNode*) DAGCombiner.cpp:0:0
#13 0x00000000037b24c8 (anonymous namespace)::DAGCombiner::Run(llvm::CombineLevel) DAGCombiner.cpp:0:0
#14 0x00000000037b4dda llvm::SelectionDAG::Combine(llvm::CombineLevel, llvm::AAResults*, llvm::CodeGenOptLevel) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x37b4dda)
#15 0x00000000039165f4 llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x39165f4)
#16 0x0000000003919782 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3919782)
#17 0x000000000391aaa0 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x391aaa0)
#18 0x000000000390b7df llvm::SelectionDAGISelLegacy::runOnMachineFunction(llvm::MachineFunction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x390b7df)
#19 0x0000000002aee0a9 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0
#20 0x00000000030e6070 llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x30e6070)
#21 0x00000000030e6421 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x30e6421)
#22 0x00000000030e6cd7 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x30e6cd7)
#23 0x00000000008641fc compileModule(char**, llvm::LLVMContext&) llc.cpp:0:0
#24 0x00000000007514f6 main (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x7514f6)
#25 0x000070dc43229d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#26 0x000070dc43229e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#27 0x000000000085aefe _start (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x85aefe)
Program terminated with signal: SIGSEGV
Compiler returned: 139
```

Compiler explorer link: https://godbolt.org/z/KWx9zGd3Y

It looks like it started to crash since https://github.com/llvm/llvm-project/commit/59d14b623357d9b0514a9575e6d92474694b2f74


</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzUWd9z2yoW_mvIC2OPhH4_5MGx42xm072ZutvtPnkQQjYbBFpAjt2_fgckOcZxm-be7M7dTutiBN_5vsPhHIGx1mwjKL0GyQ1IFle4M1uprkWnmu5pixtq5O6qlNXhei6FZhVV0GwprCXn8pmJDSSyoiBYgGA2fKZB_xfrpu8xWG2ogRU2mOOD7AwE0QIChOikAdFsP2lBNIuQ-5i0KAv8r6H_1bbS2H1M2LERohxEsxDlkzoPhpZwXWk_E4No1gNPVhECCHncjGItpyMvlubppCWTZyYq-awnjd6R44z-s6I1ExTuJKsgiIN6XXfr9boT62i-7kS9jm7XuwMDltU8TOEeMivhFgKU7Ndc4gqgOWyNsh2yrjU1-tGoKQOogCC76Y1gziXBGkSDUWhHNx1fr3sMx7fpODw3Es1ZhCAKrJE_YSu6tV9eXDGI00Yq-kqLp_iHXptDzNlGwPjEUyWnogqnLERT5lxFMHe-yuEe1lxi4wzEAee7ZrrP0yne7adu1m7a6ilK0n4BvfHfqZJMMMMwZ9-pckrOIaO5a8NgH6W3cXDyxw7_v382rN9bjinO12LKwmhYCr3t6prTHSVGqrehLvjYX99hyIVdcAy88BiBYyMaG_HYSMZGOjaysZGPjeII-AJ9xA6P4OERPTzCh4n13ZlXZvpemCk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