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

    <tr>
        <th>Summary</th>
        <td>
            AArch64 UDOT "Cannot select" error
        </td>
    </tr>

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

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

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

<pre>
    LLVM appears to be failing in instruction selection when compiling the attached matmul_aarch64.ll file with llc.

`llc` is built from branch `release/14.x`, with the most recent commit being ebf29ba9f0a3a1076c613aef59e65d65435daaee .

Trace:
```
31-35-226:matmul ajroot$ /Users/ajroot/llvm-install-14/bin/llc matmul_aarch64.ll -o temp.s
LLVM ERROR: Cannot select: t1824: v4i32 = AArch64ISD::UDOT t63, t1826, t58
  t63: v4i32,ch = load<(load (s128) from %ir.2663, !tbaa !12)> t0, t62, undef:i64
    t62: i64 = add nuw t49, Constant:i64<32>
      t49: i64,ch = CopyFromReg t0, Register:i64 %592
        t48: i64 = Register %592
      t61: i64 = Constant<32>
    t4: i64 = undef
  t1826: v16i8 = AArch64ISD::ZIP2 t1829, t1828
    t1829: v16i8 = AArch64ISD::ZIP1 t5, t11
      t5: v16i8,ch = load<(load (s128) from %ir.lsr.iv167179, align 4, !tbaa !15)> t0, t2, undef:i64
        t2: i64,ch = CopyFromReg t0, Register:i64 %601
          t1: i64 = Register %601
        t4: i64 = undef
      t11: v16i8,ch = load<(load (s128) from %ir.scevgep180181, align 2, !tbaa !15)> t0, t10, undef:i64
        t10: i64 = add t2, t9
          t2: i64,ch = CopyFromReg t0, Register:i64 %601
            t1: i64 = Register %601
          t9: i64 = AssertSext t7, ValueType:ch:i33
            t7: i64,ch = CopyFromReg t0, Register:i64 %35
              t6: i64 = Register %35
        t4: i64 = undef
    t1828: v16i8 = AArch64ISD::ZIP1 t26, t32
      t26: v16i8,ch = load<(load (s128) from %ir.scevgep195196, align 1, !tbaa !15)> t0, t25, undef:i64
        t25: i64 = add t2, t24
          t2: i64,ch = CopyFromReg t0, Register:i64 %601
            t1: i64 = Register %601
          t24: i64 = AssertSext t22, ValueType:ch:i32
            t22: i64,ch = CopyFromReg t0, Register:i64 %7
              t21: i64 = Register %7
        t4: i64 = undef
      t32: v16i8,ch = load<(load (s128) from %ir.scevgep197198, align 1, !tbaa !15)> t0, t31, undef:i64
        t31: i64 = add t2, t30
          t2: i64,ch = CopyFromReg t0, Register:i64 %601
            t1: i64 = Register %601
          t30: i64 = AssertSext t28, ValueType:ch:i34
            t28: i64,ch = CopyFromReg t0, Register:i64 %25
              t27: i64 = Register %25
        t4: i64 = undef
  t58: v16i8 = bitcast t1827
    t1827: v4i32 = AArch64ISD::DUP t1328
      t1328: i32,ch = load<(load (s32) from %ir.scevgep157158, !tbaa !17)> t0, t46, undef:i64
        t46: i64 = add t43, t45
          t43: i64,ch = CopyFromReg t0, Register:i64 %588
            t42: i64 = Register %588
          t45: i64,ch = CopyFromReg t0, Register:i64 %602
            t44: i64 = Register %602
        t4: i64 = undef
In function: matmul_aarch64_llvm14_par_for_multiplied_no_offsets_s1_y_y
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments:/Users/ajroot/llvm-install-14/bin/llc bin/matmul_aarch64.ll -o temp.s
1.      Running pass 'Function Pass Manager' on module 'bin/matmul_aarch64.ll'.
2.      Running pass 'AArch64 Instruction Selection' on function '@matmul_aarch64_llvm14_par_for_multiplied_no_offsets_s1_y_y'
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0  llc                      0x000000010faf0267 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 39
1  llc                      0x000000010faeede8 llvm::sys::RunSignalHandlers() + 248
2  llc                      0x000000010faf08b0 SignalHandler(int) + 272
3  libsystem_platform.dylib 0x00007fff71fdb5fd _sigtramp + 29
4  libsystem_platform.dylib 000000000000000000 _sigtramp + 18446603338603711008
5  libsystem_c.dylib        0x00007fff71eb1808 abort + 120
6  llc                      0x000000010fa218c8 llvm::report_fatal_error(llvm::Twine const&, bool) + 456
7  llc                      0x000000010f94dd41 llvm::SelectionDAGISel::CannotYetSelect(llvm::SDNode*) + 1009
8  llc                      0x000000010f94acf0 llvm::SelectionDAGISel::SelectCodeCommon(llvm::SDNode*, unsigned char const*, unsigned int) + 20928
9  llc                      0x000000010e126daf (anonymous namespace)::AArch64DAGToDAGISel::Select(llvm::SDNode*) + 37887
10 llc                      0x000000010f940053 llvm::SelectionDAGISel::DoInstructionSelection() + 1491
11 llc                      0x000000010f93e98b llvm::SelectionDAGISel::CodeGenAndEmitDAG() + 6411
12 llc                      0x000000010f93bc91 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) + 7841
13 llc                      0x000000010f937f72 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) + 2754
14 llc                      0x000000010ed3bd4a llvm::MachineFunctionPass::runOnFunction(llvm::Function&) + 362
15 llc                      0x000000010f1f3e0f llvm::FPPassManager::runOnFunction(llvm::Function&) + 1199
16 llc                      0x000000010f1fad98 llvm::FPPassManager::runOnModule(llvm::Module&) + 72
17 llc                      0x000000010f1f4551 llvm::legacy::PassManagerImpl::run(llvm::Module&) + 1041
18 llc                      0x000000010d916eb5 compileModule(char**, llvm::LLVMContext&) + 7397
19 llc                      0x000000010d914c9f main + 1327
20 libdyld.dylib            0x00007fff71de2cc9 start + 1
Abort trap: 6
```
[matmul_aarch64.txt](https://github.com/llvm/llvm-project/files/8567903/matmul_aarch64.txt)
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzNWUtv4zYQ_jXOhYghPvQ6-OA4SRtg0w2S7ALtxaAkytauJBoSlaz76zskpVh-K24PNYxE5mPmm5mPwxk7ksl68uXL90fEVyvBqxopiSKBUp7lWblAWQnvWlVNrDJZol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