<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/58887>58887</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[AArch64] llc with LLVM_ENABLE_EXPENSIVE_CHECKS on build crash
</td>
</tr>
<tr>
<th>Labels</th>
<td>
backend:AArch64
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
bcl5980
</td>
</tr>
</table>
<pre>
```
; RUN: llc -verify-machineinstrs < %s -mtriple=aarch64-linux-gnu -verify-machineinstrs | FileCheck %s
define i8 @commute_subop0_anyext(i16 %a, i16 %b, i32 %c) {
%aa = mul i16 %a, 111
%bb = mul i16 %b, 222
%a_32 = zext i16 %aa to i32
%b_32 = zext i16 %bb to i32
%sub = sub i32 %a_32, %b_32
%add = add i32 %sub, %c
%trunc = trunc i32 %add to i8
%r = shl i8 %trunc, 3
ret i8 %r
}
```
Trigger assert:
Assertion failed: CurrentLatencyDiff <= PrevLatencyDiff && "Current pattern is better than previous pattern.", file D:\code\llvm-project\llvm\lib\CodeGen\MachineCombiner.cpp, line 572
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: buildbg\\bin\\llc -verify-machineinstrs -mtriple=aarch64-linux-gnu -verify-machineinstrs
1. Running pass 'Function Pass Manager' on module '<stdin>'.
2. Running pass 'Machine InstCombiner' on function '@commute_subop0_anyext'
Exception Code: 0x80000003
#0 0x00007ff7ac3c155c HandleAbort D:\code\llvm-project\llvm\lib\Support\Windows\Signals.inc:414:0
#1 0x00007ffc971390ed (C:\WINDOWS\SYSTEM32\ucrtbased.dll+0xa90ed)
#2 0x00007ffc9713ae49 (C:\WINDOWS\SYSTEM32\ucrtbased.dll+0xaae49)
#3 0x00007ffc97141345 (C:\WINDOWS\SYSTEM32\ucrtbased.dll+0xb1345)
#4 0x00007ffc97140bd7 (C:\WINDOWS\SYSTEM32\ucrtbased.dll+0xb0bd7)
#5 0x00007ffc9713eba1 (C:\WINDOWS\SYSTEM32\ucrtbased.dll+0xaeba1)
#6 0x00007ffc971418af (C:\WINDOWS\SYSTEM32\ucrtbased.dll+0xb18af)
#7 0x00007ff7aa5d06fd `anonymous namespace'::MachineCombiner::verifyPatternOrder D:\code\llvm-project\llvm\lib\CodeGen\MachineCombiner.cpp:571:0
#8 0x00007ff7aa5cd99c `anonymous namespace'::MachineCombiner::combineInstructions D:\code\llvm-project\llvm\lib\CodeGen\MachineCombiner.cpp:640:0
#9 0x00007ff7aa5cd4d7 `anonymous namespace'::MachineCombiner::runOnMachineFunction D:\code\llvm-project\llvm\lib\CodeGen\MachineCombiner.cpp:777:0
#10 0x00007ff7aa5173d4 llvm::MachineFunctionPass::runOnFunction(class llvm::Function &) D:\code\llvm-project\llvm\lib\CodeGen\MachineFunctionPass.cpp:91:0
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJytVtty2zYQ_RrqBWMNCBK8POhBluTGU9vxRGnSPnkAEJLYkCAHBB27X99dkLIurWcaNRwOAQK7Zw92FwvIpnidBQkdX7oM6DyIrsmn3x6CaE6qSpGrZ23LzetVLdSuNLo0nbMdCaIFCRjvyFXtbNlWOoiWQli1S-KrqjT9y9XW9O_ppgtyU1Z6sdPqm0cZDftvoTcgSsqMBDFVTV33Tj91vWxa-iTMq35xAcvKMEFFEbAFGfvS9yOGfRWwHMxcD4jEiwrgvCR1X5Fj5TAMj4SkPBfyqIyxY6QnNAJifwGXNzBBXIPmj9H-TRBM_EMQVuflsB1XgEbQ9AhzbL4ovDC2ozDojbLqSNDZ3igvOvT2yKCHDLIjUTuY31Xe7aMqQkZ7IavdOGfHYKXLsXOWPf772ZbbrbZEdJ22DlLpeHLuB8vGkI2ANCgw0xa9tdq4O-G0Ua_LcrPBFENWj1Y_nwyzBF5o2KhDWuGctoaUHZEau8TthCEtKJZN3-3np6CCa9qATbJETnyhmkJDU1XP9VVrmz-1cuMvNq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