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

    <tr>
        <th>Summary</th>
        <td>
            AArch64 backend: Assertion `(TLI.getTypeAction(*DAG.getContext(), Op.getValueType()) == TargetLowering::TypeLegal || Op.getOpcode() == ISD::TargetConstant || Op.getOpcode() == ISD::Register) && "Unexpected illegal type!"' failed.
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            backend:AArch64,
            crash-on-valid
      </td>
    </tr>

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

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

<pre>
    this function:
```llvm
target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
target triple = "aarch64-linux-gnu"

define i62 @f(i1 %0) {
  %2 = zext i1 %0 to i59
  %3 = call { i59, i1 } @llvm.umul.with.overflow.i59(i59 %2, i59 -1)
  %4 = extractvalue { i59, i1 } %3, 0
  %5 = trunc i59 %4 to i21
  %6 = trunc i59 %4 to i21
  %7 = ashr i21 %5, %6
  %8 = sext i21 %7 to i62
  %9 = icmp ugt i62 -1, %8
  %10 = zext i1 %9 to i62
 ret i62 %10
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare { i59, i1 } @llvm.umul.with.overflow.i59(i59, i59) #0

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

causes the SDAG backend for AArch64 to exit abnormally:
```
regehr@john-home:~/test$ llc reduced.ll 
llc: /home/regehr/llvm-project/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:975: void {anonymous}::SelectionDAGLegalize::LegalizeOp(llvm::SDNode*): Assertion `(TLI.getTypeAction(*DAG.getContext(), Op.getValueType()) == TargetLowering::TypeLegal || Op.getOpcode() == ISD::TargetConstant || Op.getOpcode() == ISD::Register) && "Unexpected illegal type!"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: llc reduced.ll
1.      Running pass 'Function Pass Manager' on module 'reduced.ll'.
2.      Running pass 'AArch64 Instruction Selection' on function '@f'
 #0 0x00007f08a06fead6 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/regehr/llvm-project/for-alive/bin/../lib/libLLVMSupport.so.17git+0x1daad6)
 #1 0x00007f08a06fbf24 SignalHandler(int) Signals.cpp:0:0
 #2 0x00007f08a00dc520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #3 0x00007f08a0130a7c __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
 #4 0x00007f08a0130a7c __pthread_kill_internal ./nptl/pthread_kill.c:78:10
 #5 0x00007f08a0130a7c pthread_kill ./nptl/pthread_kill.c:89:10
 #6 0x00007f08a00dc476 gsignal ./signal/../sysdeps/posix/raise.c:27:6
 #7 0x00007f08a00c27f3 abort ./stdlib/abort.c:81:7
 #8 0x00007f08a00c271b _nl_load_domain ./intl/loadmsgcat.c:1177:9
 #9 0x00007f08a00d3e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#10 0x00007f08a2b95c98 (anonymous namespace)::SelectionDAGLegalize::LegalizeOp(llvm::SDNode*) LegalizeDAG.cpp:0:0
#11 0x00007f08a2b9f80d llvm::SelectionDAG::Legalize() (/home/regehr/llvm-project/for-alive/bin/../lib/libLLVMSelectionDAG.so.17git+0x19080d)
#12 0x00007f08a2d792c1 llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/home/regehr/llvm-project/for-alive/bin/../lib/libLLVMSelectionDAG.so.17git+0x36a2c1)
#13 0x00007f08a2d7e4e6 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/home/regehr/llvm-project/for-alive/bin/../lib/libLLVMSelectionDAG.so.17git+0x36f4e6)
#14 0x00007f08a2d80067 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (/home/regehr/llvm-project/for-alive/bin/../lib/libLLVMSelectionDAG.so.17git+0x371067)
#15 0x00007f08a2346f46 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (/home/regehr/llvm-project/for-alive/bin/../lib/libLLVMCodeGen.so.17git+0x3e0f46)
#16 0x00007f08a0ab9ab3 llvm::FPPassManager::runOnFunction(llvm::Function&) (/home/regehr/llvm-project/for-alive/bin/../lib/libLLVMCore.so.17git+0x2a7ab3)
#17 0x00007f08a0ab9ce9 llvm::FPPassManager::runOnModule(llvm::Module&) (/home/regehr/llvm-project/for-alive/bin/../lib/libLLVMCore.so.17git+0x2a7ce9)
#18 0x00007f08a0aba582 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/home/regehr/llvm-project/for-alive/bin/../lib/libLLVMCore.so.17git+0x2a8582)
#19 0x0000560927128547 compileModule(char**, llvm::LLVMContext&) llc.cpp:0:0
#20 0x000056092711ce24 main (/home/regehr/llvm-project/for-alive/bin/llc+0x12e24)
#21 0x00007f08a00c3d90 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
#22 0x00007f08a00c3e40 call_init ./csu/../csu/libc-start.c:128:20
#23 0x00007f08a00c3e40 __libc_start_main ./csu/../csu/libc-start.c:379:5
#24 0x000056092711d335 _start (/home/regehr/llvm-project/for-alive/bin/llc+0x13335)
Aborted (core dumped)
regehr@john-home:~/test$ 
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsWEtz2zgS_jXwBSUVCPB50IG2o2yqnE1qnJ2rCgRbFCYgyAJAP-awv30LICWRijbJzGYzl6mKHRNsfN1fv9AEt1Y2GmCDkluU3N_wwR06szHQwMHcVF39unEHafF-0MLJTiNWInKPSIlSMv5T6qkdlxw3DThcc8cVf-0GhxG7x4hSWLWIlbCSOWKl_2F0JaMUsTL88k9pjFiZxisZUS8Q0XylGR3XHv0apQslzshewVEB50Yc0nilpB5eVo0eTuLj7xr2UgOWKcUoJntEcxlhRBOCaIFRdjtKYb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