<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/159116>159116</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[PowerPC] crashed at -O1: LLVM ERROR: Found 1 machine code errors.
</td>
</tr>
<tr>
<th>Labels</th>
<td>
backend:PowerPC,
crash-on-valid
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
XChy
</td>
</tr>
</table>
<pre>
Reproducer: https://godbolt.org/z/dW4Mn4xvv
Testcase:
```llvm
define i32 @func_1(i64 %vecext24) {
entry:
br label %asm.fallthrough
asm.fallthrough: ; preds = %cond.end, %entry
%BS_VAR_11.2 = phi i8 [ %conv8, %cond.end ], [ 0, %entry ]
%conv7 = sext i8 %BS_VAR_11.2 to i32
%rem = srem i32 %conv7, 7
%conv8 = trunc i32 %rem to i8
%cmp.scalar = icmp slt i32 %conv7, 0
%vecins = insertelement <4 x i16> zeroinitializer, i16 0, i64 %vecext24
%vecinit26 = insertelement <32 x i8> zeroinitializer, i8 0, i64 0
%conv58 = sext <32 x i8> %vecinit26 to <32 x i32>
%vecext59 = extractelement <32 x i32> %conv58, i64 0
%cmp122 = icmp ult i32 %vecext59, 1
br i1 %cmp122, label %cond.true, label %cond.end
cond.true: ; preds = %asm.fallthrough
%vecext124 = extractelement <4 x i16> %vecins, i64 0
%conv125 = sext i16 %vecext124 to i32
br label %cond.end
cond.end: ; preds = %cond.true, %asm.fallthrough
%cond = phi i32 [ %conv125, %cond.true ], [ 1, %asm.fallthrough ]
store i32 %cond, ptr null, align 4
br label %asm.fallthrough
}
```
Output:
```
LLVM ERROR: Found 1 machine code errors.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.
Stack dump:
0. Program arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/llc -o /app/output.s -x86-asm-syntax=intel -O1 <source>
1. Running pass 'Function Pass Manager' on module '<source>'.
2. Running pass 'PowerPC MI Peephole Optimization' on function '@func_1'
#0 0x00000000040de748 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x40de748)
#1 0x00000000040db5f4 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
#2 0x000077e66bc42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#3 0x000077e66bc969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
#4 0x000077e66bc42476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
#5 0x000077e66bc287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
#6 0x00000000007b44ff llvm::json::operator==(llvm::json::Value const&, llvm::json::Value const&) (.cold) JSON.cpp:0:0
#7 0x000000000311c0af (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x311c0af)
#8 0x00000000031342b6 llvm::MachineFunction::verify(llvm::Pass*, char const*, llvm::raw_ostream*, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x31342b6)
#9 0x0000000001c73219 (anonymous namespace)::PPCMIPeephole::runOnMachineFunction(llvm::MachineFunction&) PPCMIPeephole.cpp:0:0
#10 0x0000000002ff7209 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0
#11 0x000000000362ea98 llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x362ea98)
#12 0x000000000362ecd1 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x362ecd1)
#13 0x000000000362f53f llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x362f53f)
#14 0x00000000008eafcd compileModule(char**, llvm::LLVMContext&) llc.cpp:0:0
#15 0x00000000007bc2e6 main (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x7bc2e6)
#16 0x000077e66bc29d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#17 0x000077e66bc29e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#18 0x00000000008e1425 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x8e1425)
Program terminated with signal: SIGSEGV
Compiler returned: 139
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJy8WFtv2zoS_jX0C2FDou4PflAuPttFswmSg-6-GRRFyzylSIGkXKe_fjGUXMmOCyS7wQlcVBZnvvnmStLUWtEoztcouUHJ3YL2bq_N-j-3-9dFpevX9TPvjK57xg2KSrx3rrMoKhHZILJpdF1p6VbaNIhsfiKyqf8dP6j4eDigoPyTW8eo5SAelCgNho-UhxYFZc13QnEsIoJRHOx6xbYhIrlIY4xIcuCMHx2JESkwym5QUHLlzOsAhXFlsKQVlyBKbbvaUSnd3ui-2YOpoLx8GZUYRTe4M7y2GEV3oMi0qldc1YjcwtfBAKAjkty8bL-Vz9swXBEv3u0FFjlGyc2oechHtRMKRsmdf5Xc4GAO6RdGWFDMPKDlR-cRz205DRE5iRveDsLw4CM1QgB-NgfNvZwzvWInQdABuBzkQKztVpZRSY2XFaztsJXuDW5wwj1wJtQQLaEsN45L3nLlMIpuY3zEIkxRdI9_cqOFEk5QKX5yAxAiTIcYXGZzjiwcSa-DRwTQ89-B5xN2MI9Bkk-RPUc5M-n0tBoRFN3PWPGjSwqPwo_OUPaWldeYLL4l0nYhIVOE-ynCJ3zQCU9lLMJJCxZ-lbWvK2d6_vYt1Kyv8kkmKvE7_960wdv-mUUjJPFvwjGrgF-1chaNMUYhSWYFH6bn2LN6n_f0FTfh22-7-BSn6-6MUlMjQz6mTg5JMu9lwJo3c3gd-FdbW6cNn3WRnyedM1j1UsIzlaJROH7P4Mru5pNy8P6xd13vLoYoCsqvX7894Pvn58dniMtG96rGIW4p28NcZbrmmBujjV2hoHz6el--3GPbV61wmOKqb7Dhn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