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

    <tr>
        <th>Summary</th>
        <td>
            LLVM ERROR: Unable to expand fixed point multiplication.
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

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

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

<pre>
    LLVM crashes with the following error message when compiling a short LLVM IR snippet:

```
LLVM ERROR: Unable to expand fixed point multiplication.
```

```llvm
target datalayout = "e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-n32:64-S128-ni:1:10:20"
target triple = "wasm32-unknown-unknown-musl"

define internal fastcc void @src.formats.png.reader.TrnsProcessor.processDataRow() {
Block28:
  %0 = call i16 @llvm.umul.fix.sat.i16(i16 0, i16 1, i32 0)
  store i16 %0, ptr null, align 1
  ret void
}

; Function Attrs: nocallback nofree nosync nounwind readnone speculatable willreturn
declare i16 @llvm.umul.fix.sat.i16(i16, i16, i32 immarg) #0

attributes #0 = { nocallback nofree nosync nounwind readnone speculatable willreturn }
```

```
Stack dump:
0.      Program arguments: /home/felix/projects/forks/zig-deps/prefix/llvm-15-release/bin/llc /tmp/foo.ll
1.      Running pass 'Function Pass Manager' on module '/tmp/foo.ll'.
2.      Running pass 'WebAssembly Instruction Selection' on function '@src.formats.png.reader.TrnsProcessor.processDataRow'
 #0 0x0000559d89b28c40 PrintStackTraceSignalHandler(void*) Signals.cpp:0:0
 #1 0x0000559d89b26444 SignalHandler(int) Signals.cpp:0:0
 #2 0x00007fc7456e8900 __restore_rt sigaction.c:0:0
 #3 0x00007fc745076f81 raise /builddir/glibc-2.32/signal/../sysdeps/unix/sysv/linux/raise.c:50:1
 #4 0x00007fc745060536 abort /builddir/glibc-2.32/stdlib/abort.c:81:7
 #5 0x0000559d8739001d llvm::DisplayGraph(llvm::StringRef, bool, llvm::GraphProgram::Name) (.cold) GraphWriter.cpp:0:0
 #6 0x0000559d89a6f518 (/home/felix/projects/forks/zig-deps/prefix/llvm-15-release/bin/llc+0x2f8b518)
 #7 0x0000559d8994809d llvm::TargetLowering::expandFixedPointMul(llvm::SDNode*, llvm::SelectionDAG&) const (/home/felix/projects/forks/zig-deps/prefix/llvm-15-release/bin/llc+0x2e6409d)
 #8 0x0000559d8981c320 (anonymous namespace)::SelectionDAGLegalize::ExpandNode(llvm::SDNode*) LegalizeDAG.cpp:0:0
 #9 0x0000559d89818ffb (anonymous namespace)::SelectionDAGLegalize::LegalizeOp(llvm::SDNode*) LegalizeDAG.cpp:0:0
#10 0x0000559d8982840d llvm::SelectionDAG::Legalize() (/home/felix/projects/forks/zig-deps/prefix/llvm-15-release/bin/llc+0x2d4440d)
#11 0x0000559d8990be53 llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/home/felix/projects/forks/zig-deps/prefix/llvm-15-release/bin/llc+0x2e27e53)
#12 0x0000559d8990ea93 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/home/felix/projects/forks/zig-deps/prefix/llvm-15-release/bin/llc+0x2e2aa93)
#13 0x0000559d89911028 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (.part.0) SelectionDAGISel.cpp:0:0
#14 0x0000559d88e26979 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0
#15 0x0000559d892be180 llvm::FPPassManager::runOnFunction(llvm::Function&) (/home/felix/projects/forks/zig-deps/prefix/llvm-15-release/bin/llc+0x27da180)
#16 0x0000559d892be2ec llvm::FPPassManager::runOnModule(llvm::Module&) (/home/felix/projects/forks/zig-deps/prefix/llvm-15-release/bin/llc+0x27da2ec)
#17 0x0000559d892bee78 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/home/felix/projects/forks/zig-deps/prefix/llvm-15-release/bin/llc+0x27dae78)
#18 0x0000559d8744eca4 compileModule(char**, llvm::LLVMContext&) llc.cpp:0:0
#19 0x0000559d8739f502 main (/home/felix/projects/forks/zig-deps/prefix/llvm-15-release/bin/llc+0x8bb502)
#20 0x00007fc745061e0a __libc_start_main /builddir/glibc-2.32/csu/../csu/libc-start.c:314:16
#21 0x0000559d874475fa _start /builddir/glibc-2.32/csu/../sysdeps/x86_64/start.S:122:0
```

This problem was found via the `zig` toolchain in issue https://github.com/ziglang/zig/issues/13258
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzFWFlz2zYQ_jXSC0YcELwf9GDHcZqZOHHttHn0gCAooQEBDgBGdn99F6AuKoqTZuLWY5E4d789sWCtm6flu3d_3iBmqF1zizbCrZFbc9RqKfVGqBXixmiDOm4tXXG0WXOFmO56If0kRXatjUOByNs7ZJXoe-5mycUMX83w7pnj7X_ohsWv7-4-3ME69IeiteTIacQfe6oa1IpH3qBeC-VQN0gneikYdUKr6Cy5k0Epv3TjkKNmxR1qqKOSPunBoVlyhWaE8EUHnPmih2dCwmPRxxgapf8tenJoizyFd54uVFgJjfuYlAsloBP7n18K6wmZMHUGYPMdww21HfAY1GelN2r_7gYr9xvHZ8NboTgC2blRVKKWWscY-qJFg2YptoZFrTYddTbq1SoynDbcRB-NsrdGMzCSNlE_tq5A7ju9mZFyRio0Ky5HDpdSs8-k3JsIAcAMB6SMSolEnHtOXo3RAPqPwB6RpS6CCaDlp0HaV2FdHBoJ8SPVjpx12vCRDBD2K3pnkBqk9G0qxUrBxu1iA7rywm11UFxNbJpcoutBMW97dOGcsd5hlPY4a8o-Q7M1nMPLPikGr0GByzbIa0VpUKPtORsk6MF72EZICewGo3aqZpLukD4r8FbcnbCi68DIQakkmTghBYyiHhxEkp8azV9c_gLI6KCaZ71_7N47z6oZun5vZgzBU4GPrAztEMAfOq5c0OeMXK91x-HVcike4Q0O9BdnMAtD2nz277_FatHw3oZZ8FG_zGtsEWcLwyWn1hOohQrjzBN1wN0T0BFYPmCIPYa7QSmfOnpqvZaK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