<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/63689>63689</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[PowerPC] Wasn't expecting to be able to lower this! UNREACHABLE executed at /usr/src/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCISelLowering.cpp:11299!
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
pkubaj
</td>
</tr>
</table>
<pre>
FreeBSD 14.0-CURRENT
powerpc, powerpc64, powerpc64le
LLVM 16.0.6
Test case:
```
extern "C" int abs(int);
struct {
int width;
} __trans_tmp_1, Bayer2RGB_VNG_8u_size = __trans_tmp_1;
struct AutoBuffer {
AutoBuffer(long);
};
void Bayer2RGB_(int, int, int);
int Bayer2RGB_VNG_8u_code, Bayer2RGB_VNG_8u_bstep, Bayer2RGB_VNG_8u_brows,
Bayer2RGB_VNG_8u_bcn,
Bayer2RGB_VNG_8u_N = Bayer2RGB_VNG_8u_size.width, Bayer2RGB_VNG_8u_N3,
Bayer2RGB_VNG_8u_N7,
Bayer2RGB_VNG_8u_bufstep = Bayer2RGB_VNG_8u_N7 * Bayer2RGB_VNG_8u_bcn,
demosaicing_dcn, demosaicing_code;
unsigned short Bayer2RGB_VNG_8u_buf;
void Bayer2RGB_VNG_8u(int srcmat, int dstmat) {
Bayer2RGB_(srcmat, dstmat, Bayer2RGB_VNG_8u_code);
int i;
AutoBuffer(Bayer2RGB_VNG_8u_bufstep * Bayer2RGB_VNG_8u_brows);
unsigned char *srow;
for (int dy = 0; dy <= 1; dy++) {
unsigned short *brow = &Bayer2RGB_VNG_8u_buf;
for (; i < Bayer2RGB_VNG_8u_N; i++, srow++, brow++)
brow[Bayer2RGB_VNG_8u_N3] = abs(srow[1] - srow[Bayer2RGB_VNG_8u_bstep]);
}
}
```
Compile with:
`/usr/bin/c++ -cc1 -triple powerpc-unknown-freebsd14.0 -emit-obj -target-cpu pwr9 -O1 -fcxx-exceptions -fexceptions -vectorize-loops demosaicing-7698e9.cpp`
Output:
```
Wasn't expecting to be able to lower this!
UNREACHABLE executed at /usr/src/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCISelLowering.cpp:11299!
PLEASE submit a bug report to https://bugs.freebsd.org/submit/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: /usr/bin/c++ -cc1 -triple powerpc-unknown-freebsd14.0 -emit-obj -target-cpu pwr9 -O1 -Weverything -fcxx-exceptions -fexceptions -vectorize-loops demosaicing-7698e9.cpp
1. <eof> parser at end of file
2. Code generation
3. Running pass 'Function Pass Manager' on module 'demosaicing-7698e9.cpp'.
4. Running pass 'PowerPC DAG->DAG Pattern Instruction Selection' on function '@_Z16Bayer2RGB_VNG_8uii'
#0 0x0000000015acd96c PrintStackTrace /usr/src/contrib/llvm-project/llvm/lib/Support/Unix/Signals.inc:567:13
#1 0x0000000015acb288 RunSignalHandlers /usr/src/contrib/llvm-project/llvm/lib/Support/Signals.cpp:103:5
#2 0x0000000015ace2d0 SignalHandler /usr/src/contrib/llvm-project/llvm/lib/Support/Unix/Signals.inc:0:3
#3 0x000000081810c720 handle_signal /usr/src/lib/libthr/thread/thr_sig.c:303:3
```
It seems to build with main branch, would it be possible to cherry-pick the fix to 16?
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzEV0lv47gS_jX0pSBBoizLPvjgJe5pIJMJku4Z4F0MiirZ7MikwKXtzK9_ICVviRO8rfEMw2YtZH31sViUmDFiIxGnJJ-TfDlgzm6VnrYvrmQ_BqWqXqcrjTh_XkI6jJNo8f3p6e7hG0mWJJm1ao-65YQuoB-OhldCg53j_f2fv0M6ipN41Cm6329oLHBmkGS9hoyS_htEPFjUEgilC0IpCGmBlYbQsZCW0AnJ5p2fsdpxC6ToZQiue1HZ7cmHFEtYr61m0qztrl2nHumcvaKmT1_m6z8fvqzH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